diff options
author | Victor Mocanu | 2018-04-04 12:32:17 +0200 |
---|---|---|
committer | Victor Mocanu | 2018-04-04 12:32:17 +0200 |
commit | 376a68894214b708c9e4ea01e779484bdba81bbb (patch) | |
tree | fb024dd3c84350ec61ab4f3f6eaa3f94b6be3981 /src/main/java | |
parent | [VBox] USB 2.0 activated per default (diff) | |
download | master-sync-shared-376a68894214b708c9e4ea01e779484bdba81bbb.tar.gz master-sync-shared-376a68894214b708c9e4ea01e779484bdba81bbb.tar.xz master-sync-shared-376a68894214b708c9e4ea01e779484bdba81bbb.zip |
[Vbox] repaired a null pointer exception when disabling USB
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/openslx/util/vm/VboxConfig.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/org/openslx/util/vm/VboxConfig.java b/src/main/java/org/openslx/util/vm/VboxConfig.java index 77a1574..45dfb48 100644 --- a/src/main/java/org/openslx/util/vm/VboxConfig.java +++ b/src/main/java/org/openslx/util/vm/VboxConfig.java @@ -483,7 +483,6 @@ public class VboxConfig Node controller2 = addNewNode( "Controllers", "Controller", true ); addAttributeToNode( controller2, "name", "EHCI" ); addAttributeToNode( controller2, "type", "EHCI" ); - } /** @@ -491,13 +490,17 @@ public class VboxConfig */ public void disableUsb() { - Node usb = findNodes( "USB" ).item( 0 ); - removeNode( usb ); + NodeList usbList = findNodes( "USB" ); + removeNode( usbList.item( 0 ) ); } // function removes a given child and the format childNode private void removeNode( Node node ) { + if (node == null ) { + LOGGER.warn( "node is null; unsafe" ); + return; + } Node parent = node.getParentNode(); // this node here is usually a type3 Node used only for the formating of the vbox file Node previousSibling = node.getPreviousSibling(); |