Skip to content

Commit 9c5c4c1

Browse files
committed
Add null checks for vehicle type and make
1 parent 0b14a39 commit 9c5c4c1

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import com.smartdevicelink.proxy.rpc.OnTouchEvent;
6161
import com.smartdevicelink.proxy.rpc.TouchCoord;
6262
import com.smartdevicelink.proxy.rpc.TouchEvent;
63+
import com.smartdevicelink.proxy.rpc.VehicleType;
6364
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
6465
import com.smartdevicelink.proxy.rpc.enums.HMILevel;
6566
import com.smartdevicelink.proxy.rpc.enums.PredefinedWindows;
@@ -95,7 +96,7 @@ public class VideoStreamManager extends BaseVideoStreamManager {
9596
private IVideoStreamListener streamListener;
9697
private boolean isTransportAvailable = false;
9798
private boolean hasStarted;
98-
private String vehicleMake;
99+
private String vehicleMake = null;
99100

100101
// INTERNAL INTERFACES
101102

@@ -180,7 +181,9 @@ public void onNotified(RPCNotification notification) {
180181
public VideoStreamManager(ISdl internalInterface){
181182
super(internalInterface);
182183

183-
vehicleMake = internalInterface.getRegisterAppInterfaceResponse().getVehicleType().getMake();
184+
if(internalInterface.getRegisterAppInterfaceResponse().getVehicleType() != null) {
185+
vehicleMake = internalInterface.getRegisterAppInterfaceResponse().getVehicleType().getMake();
186+
}
184187
virtualDisplayEncoder = new VirtualDisplayEncoder();
185188
hmiLevel = HMILevel.HMI_NONE;
186189

base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ public void update(VideoStreamingCapability capability, String vehicleMake){
142142
ImageResolution resolution = capability.getPreferredResolution();
143143
if(resolution!=null){
144144

145-
if((vehicleMake.contains("Ford") || vehicleMake.contains("Lincoln")) && ((resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 800) || (resolution.getResolutionWidth() !=null && resolution.getResolutionWidth() > 800))) {
146-
scale = 1.0 / 0.75;
145+
if (vehicleMake != null) {
146+
if ((vehicleMake.contains("Ford") || vehicleMake.contains("Lincoln")) && ((resolution.getResolutionHeight() != null && resolution.getResolutionHeight() > 800) || (resolution.getResolutionWidth() != null && resolution.getResolutionWidth() > 800))) {
147+
scale = 1.0 / 0.75;
148+
}
147149
}
148150

149151
if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight((int)(resolution.getResolutionHeight() / scale)); }

0 commit comments

Comments
 (0)