inspector: Don't crash if $os->{kernels} does not exist.
authorRichard Jones <rjones@redhat.com>
Mon, 8 Mar 2010 19:28:48 +0000 (19:28 +0000)
committerRichard Jones <rjones@redhat.com>
Mon, 8 Mar 2010 19:35:22 +0000 (19:35 +0000)
ie. on Windows.

inspector/virt-inspector

index cb892c0..707825e 100755 (executable)
@@ -407,13 +407,15 @@ sub output_text_os
         print "    $_->{name} $_->{version}\n"
     }
 
-    print __"  Kernels:\n";
-    my @kernels = @{$os->{kernels}};
-    foreach (@kernels) {
-        print "    $_->{version} ($_->{arch})\n";
-        my @modules = @{$_->{modules}};
-        foreach (@modules) {
-            print "      $_\n";
+    if ($os->{kernels}) {
+        print __"  Kernels:\n";
+        my @kernels = @{$os->{kernels}};
+        foreach (@kernels) {
+            print "    $_->{version} ($_->{arch})\n";
+            my @modules = @{$_->{modules}};
+            foreach (@modules) {
+                print "      $_\n";
+            }
         }
     }