From: Peter Krempa Date: Thu, 25 Aug 2016 22:40:09 +0000 (-0400) Subject: conf: Fix build with picky GCC X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9cf086be6d916c52035a0ee89f3f0f020e9fee1f;p=libvirt.git conf: Fix build with picky GCC ../../src/conf/domain_conf.c:4425:21: error: potential null pointer dereference [-Werror=null-dereference] switch (vcpu->hotpluggable) { ~~~~^~~~~~~~~~~~~~ --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ae3eb14c5a..61f6dbbbaf 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4422,6 +4422,10 @@ virDomainVcpuDefPostParse(virDomainDefPtr def) for (i = 0; i < maxvcpus; i++) { vcpu = virDomainDefGetVcpu(def, i); + /* impossible but some compilers don't like it */ + if (!vcpu) + continue; + switch (vcpu->hotpluggable) { case VIR_TRISTATE_BOOL_ABSENT: if (vcpu->online)