Skip to content

Commit

Permalink
Prevent app crash in #1
Browse files Browse the repository at this point in the history
  • Loading branch information
bilde2910 committed Aug 30, 2019
1 parent 17a81a7 commit 1549838
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions android/app/src/main/java/info/varden/hauk/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ public void run(HTTPThread.Response resp) {
// A successful session initiation contains "OK" on line 1, the session ID on
// line 2, and a publicly sharable tracking link on line 3.
String[] data = resp.getData();

// Somehow the data array is empty.
if (data.length < 1) {
diagSvc.showDialog(R.string.err_server, R.string.err_empty, resetTask);
return;
}

if (data[0].equals("OK")) {
String session = data[1];
viewLink = data[2];
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<string name="err_malformed_url">The server URL you entered is invalid.</string>
<string name="err_missing_perms">Location permission is required to use this app.</string>
<string name="err_location_disabled">Location services are disabled. Please enable high-accuracy location services to share your location.</string>
<string name="err_empty">The server returned an empty response.</string>

<string name="ok_title">Connection established</string>
<string name="ok_message">Location sharing is active! Click the share button to copy the publicly viewable URL for your share.</string>
Expand Down

0 comments on commit 1549838

Please sign in to comment.