File tree 1 file changed +16
-1
lines changed
android/src/main/java/org/mozilla/mozstumbler/client
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -66,10 +66,25 @@ public void onPostExecute(IResponse response) {
66
66
return ;
67
67
}
68
68
Map <String , List <String >> headers = response .getHeaders ();
69
+ if (headers == null ) {
70
+ return ;
71
+ }
69
72
Log .i (LOG_TAG , "Got headers: " + headers .toString ());
73
+ if (headers .get ("Location" ) == null ) {
74
+ return ;
75
+ }
70
76
String locationUrl = headers .get ("Location" ).get (0 );
77
+ if (locationUrl == null || locationUrl .length () < 1 ) {
78
+ return ;
79
+ }
71
80
String [] parts = locationUrl .split ("/" );
81
+ if (parts .length < 2 ) {
82
+ return ;
83
+ }
72
84
String tag = parts [parts .length -1 ];
85
+ if (tag .length () < 2 ) {
86
+ return ;
87
+ }
73
88
String latestVersion = tag .substring (1 ); // strip the 'v' from the beginning
74
89
75
90
String installedVersion = PackageUtils .getAppVersion (activity );
@@ -129,7 +144,7 @@ private void showUpdateDialog(final Context context,
129
144
msg = String .format (msg , installedVersion , latestVersion );
130
145
131
146
if (installedVersion .startsWith ("0." ) &&
132
- latestVersion .startsWith ("1." )) {
147
+ latestVersion .startsWith ("1." )) {
133
148
// From 0.x to 1.0 and higher, the keystore changed
134
149
msg += " " + context .getString (R .string .must_uninstall_to_update );
135
150
}
You can’t perform that action at this time.
0 commit comments