Skip to content

Commit e343cc2

Browse files
Fix potential overflow issue
1 parent e419e52 commit e343cc2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

android/sdl_android/src/main/java/com/smartdevicelink/util/SdlAppInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ public int compare(SdlAppInfo one, SdlAppInfo two) {
153153
int versionCompare = two.routerServiceVersion - one.routerServiceVersion;
154154

155155
if(versionCompare == 0){ //Versions are equal so lets use the one that has been updated most recently
156-
int updateTime = (int)(two.lastUpdateTime - one.lastUpdateTime);
156+
long updateTime = two.lastUpdateTime - one.lastUpdateTime;
157157
if(updateTime == 0){
158158
//This is arbitrary, but we want to ensure all lists are sorted in the same order
159159
return one.routerServiceComponentName.getPackageName().compareTo(two.routerServiceComponentName.getPackageName());
160160
}else{
161-
return updateTime;
161+
return (updateTime < 0 ? -1 : 1);
162162
}
163163
}else{
164164
return versionCompare;

0 commit comments

Comments
 (0)