Android: Verify the string content before indexing
This commit is contained in:
parent
4b24d22385
commit
f255553ce8
|
@ -59,8 +59,10 @@ public class AboutFragment extends Fragment {
|
||||||
TextView version = (TextView) getView().findViewById(R.id.revision_text);
|
TextView version = (TextView) getView().findViewById(R.id.revision_text);
|
||||||
version.setText(getString(R.string.revision_text,
|
version.setText(getString(R.string.revision_text,
|
||||||
versionName, String.valueOf(versionCode)));
|
versionName, String.valueOf(versionCode)));
|
||||||
int start = versionName.lastIndexOf("-");
|
if (versionName.contains("-")) {
|
||||||
buildId = versionName.substring(start + 2, start + 9);
|
int start = versionName.lastIndexOf("-");
|
||||||
|
buildId = versionName.substring(start + 2, start + 9);
|
||||||
|
}
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue