Skip to content

Commit a9f31d2

Browse files
committed
android: fix to prevent invoke .name() on a null enum
1 parent 7931e77 commit a9f31d2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

android/src/main/java/com/zxcpoiu/incallmanager/InCallManagerModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1898,14 +1898,15 @@ private WritableMap getAudioDeviceStatusMap() {
18981898
for (AudioDevice s: audioDevices) {
18991899
audioDevicesJson += "\"" + s.name() + "\",";
19001900
}
1901+
19011902
// --- strip the last `,`
19021903
if (audioDevicesJson.length() > 1) {
19031904
audioDevicesJson = audioDevicesJson.substring(0, audioDevicesJson.length() - 1);
19041905
}
19051906
audioDevicesJson += "]";
19061907

19071908
data.putString("availableAudioDeviceList", audioDevicesJson);
1908-
data.putString("selectedAudioDevice", selectedAudioDevice.name());
1909+
data.putString("selectedAudioDevice", (selectedAudioDevice == null) ? "" : selectedAudioDevice.name());
19091910

19101911
return data;
19111912
}

0 commit comments

Comments
 (0)