summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenigan <rheniga1@MGC12Z921DLVCG.fbpld77.ford.com>2021-01-26 09:07:41 -0500
committerHenigan <rheniga1@MGC12Z921DLVCG.fbpld77.ford.com>2021-01-26 09:07:41 -0500
commitb3599a54ede42ea25f0e08b30aaac56a520ac8b9 (patch)
tree7933b61b736aef5824a2a96dfd8e92266d42d7b2
parent3c4c4048def6e6418cec7cd3d4bf42f305d1fc2c (diff)
downloadsdl_android-bugfix/issue_1611.tar.gz
Prevent potential npe on resolutionbugfix/issue_1611
-rw-r--r--base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
index 51c635154..8f52cf3de 100644
--- a/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
+++ b/base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
@@ -119,6 +119,11 @@ public class VideoStreamingParameters {
this.interval = params.interval;
}
if (params.resolution != null) {
+ if (this.resolution == null) {
+ this.resolution = new ImageResolution();
+ resolution.setResolutionWidth(DEFAULT_WIDTH);
+ resolution.setResolutionHeight(DEFAULT_HEIGHT);
+ }
if (params.resolution.getResolutionHeight() != null && params.resolution.getResolutionHeight() > 0) {
this.resolution.setResolutionHeight(params.resolution.getResolutionHeight());
}
@@ -152,6 +157,12 @@ public class VideoStreamingParameters {
ImageResolution resolution = capability.getPreferredResolution();
if (resolution != null) {
+ if (this.resolution == null) {
+ this.resolution = new ImageResolution();
+ resolution.setResolutionWidth(DEFAULT_WIDTH);
+ resolution.setResolutionHeight(DEFAULT_HEIGHT);
+ }
+
if (vehicleMake != null) {
if ((vehicleMake.contains("Ford") || vehicleMake.contains("Lincoln")) && ((resolution.getResolutionHeight() != null && resolution.getResolutionHeight() > 800) || (resolution.getResolutionWidth() != null && resolution.getResolutionWidth() > 800))) {
scale = 1.0 / 0.75;