]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
scripts/qmp-shell: make QMPCompleter returns explicit
authorJohn Snow <jsnow@redhat.com>
Mon, 7 Jun 2021 20:06:19 +0000 (16:06 -0400)
committerJohn Snow <jsnow@redhat.com>
Fri, 18 Jun 2021 20:10:06 +0000 (16:10 -0400)
This function returns None when it doesn't find a match; do that
explicitly.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20210607200649.1840382-13-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
scripts/qmp/qmp-shell

index ea6a87e0b34a903ba45dd6e17394ed524321e339..8d84467b538e4c5f567e7448f86696d5b67711cf 100755 (executable)
@@ -83,10 +83,10 @@ class QMPCompleter(list):
     def complete(self, text, state):
         for cmd in self:
             if cmd.startswith(text):
-                if not state:
+                if state == 0:
                     return cmd
-                else:
-                    state -= 1
+                state -= 1
+        return None
 
 
 class QMPShellError(Exception):