Skip to content

Commit 01fa481

Browse files
authored
Add multiple checks to supportsSoftButtonImages() (#1801)
This commit adds null checks and a List.size() check to PresentAlertOperation.supportsSoftButtonImages() These checks prevent crashes and returns true when soft button capabilities are unavailable This new behavior improves alignment with the other SDL libraries
1 parent a624a06 commit 01fa481

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

base/src/main/java/com/smartdevicelink/managers/screen/PresentAlertOperation.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,14 @@ private List<TTSChunk> getTTSChunksForAlert(AlertView alertView) {
416416
* @return True if soft button images are currently supported; false if not.
417417
*/
418418
private boolean supportsSoftButtonImages() {
419+
if (currentWindowCapability == null ||
420+
currentWindowCapability.getSoftButtonCapabilities() == null ||
421+
currentWindowCapability.getSoftButtonCapabilities().size() == 0 ||
422+
currentWindowCapability.getSoftButtonCapabilities().get(0) == null
423+
) {
424+
return true;
425+
}
426+
419427
SoftButtonCapabilities softButtonCapabilities = currentWindowCapability.getSoftButtonCapabilities().get(0);
420428
return softButtonCapabilities.getImageSupported().booleanValue();
421429
}

0 commit comments

Comments
 (0)