1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Catch invalid number decoding to cover cases where there is no IP address.

This commit is contained in:
James Cotton 2012-08-03 13:49:16 -05:00
parent 32ec48412d
commit 95218802da

View File

@ -72,8 +72,14 @@ public class OPTelemetryService extends Service {
break;
case MSG_CONNECT:
terminate = false;
int connection_type;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(OPTelemetryService.this);
int connection_type = Integer.decode(prefs.getString("connection_type", ""));
try {
connection_type = Integer.decode(prefs.getString("connection_type", ""));
} catch (NumberFormatException e) {
connection_type = 0;
}
switch(connection_type) {
case 0: // No connection
return;