summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorVictor Mocanu2018-02-26 12:17:39 +0100
committerVictor Mocanu2018-02-26 12:17:39 +0100
commit03a15f8eb5418975cf2165c6cc56bb50c7469662 (patch)
tree8ddcd6cb00c3040b9f9a3cb5de31e6e6e45f82c1 /src/main
parentMerge branch 'master' into vbox (diff)
downloadmaster-sync-shared-03a15f8eb5418975cf2165c6cc56bb50c7469662.tar.gz
master-sync-shared-03a15f8eb5418975cf2165c6cc56bb50c7469662.tar.xz
master-sync-shared-03a15f8eb5418975cf2165c6cc56bb50c7469662.zip
[VBox] fixed bug where the audio adapter was not selected properly, found and fixed also bug where a false adapter would throw null pointer exception
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/openslx/util/vm/VboxMetaData.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/openslx/util/vm/VboxMetaData.java b/src/main/java/org/openslx/util/vm/VboxMetaData.java
index d5e26a6..01a4970 100644
--- a/src/main/java/org/openslx/util/vm/VboxMetaData.java
+++ b/src/main/java/org/openslx/util/vm/VboxMetaData.java
@@ -284,13 +284,14 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta,
@Override
public VmMetaData.SoundCardType getSoundCard()
{
- VmMetaData.SoundCardType returnsct = null;
+ // initialize here to type None to avoid all null pointer exceptions thrown for unknown user written sound cards
+ VmMetaData.SoundCardType returnsct = VmMetaData.SoundCardType.NONE;
Element x = (Element)config.findANode( "AudioAdapter" ).item( 0 );
if ( !x.hasAttribute( "enabled" ) || ( x.hasAttribute( "enabled" ) && x.getAttribute( "enabled" ).equals( "false" ) ) ) {
- returnsct = VmMetaData.SoundCardType.NONE;
+ return returnsct;
} else {
// extra separate case for the non-existing argument}
- if ( !x.hasAttribute( "type" ) ) {
+ if ( !x.hasAttribute( "controller" ) ) {
returnsct = VmMetaData.SoundCardType.AC;
} else {
String controller = x.getAttribute( "controller" );
@@ -363,10 +364,10 @@ public class VboxMetaData extends VmMetaData<VBoxSoundCardMeta, VBoxDDAccelMeta,
@Override
public VmMetaData.EthernetDevType getEthernetDevType( int cardIndex )
{
- VmMetaData.EthernetDevType returnedt = null;
+ VmMetaData.EthernetDevType returnedt = VmMetaData.EthernetDevType.NONE;
Element x = (Element)config.findANode( "Adapter" ).item( 0 );
if ( !x.hasAttribute( "enabled" ) || ( x.hasAttribute( "enabled" ) && x.getAttribute( "enabled" ).equals( "false" ) ) ) {
- returnedt = VmMetaData.EthernetDevType.NONE;
+ return returnedt;
} else {
// extra separate case for the non-existing argument}
if ( !x.hasAttribute( "type" ) ) {