Android: Verify the string content before indexing

This commit is contained in:
Ender's Games 2018-10-01 01:02:58 -04:00
parent 4b24d22385
commit f255553ce8
1 changed files with 4 additions and 2 deletions

View File

@ -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();
} }