diff mbox

[v2,07/14] cmdline: accept NULL opts in qemu_opt_find

Message ID 1334180081-6172-8-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini April 11, 2012, 9:34 p.m. UTC
This simplifies the code in cases where we process the options without
qemu_opts_foreach.  One example is -machine, the next patch will rely
on this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-option.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/qemu-option.c b/qemu-option.c
index 55cbee8..7a89eeb 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -511,6 +511,10 @@  static QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name)
 {
     QemuOpt *opt;
 
+    if (!opts) {
+        return NULL;
+    }
+
     QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) {
         if (strcmp(opt->name, name) != 0)
             continue;