mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
Catch invalid number decoding to cover cases where there is no IP address.
This commit is contained in:
parent
32ec48412d
commit
95218802da
@ -72,8 +72,14 @@ public class OPTelemetryService extends Service {
|
|||||||
break;
|
break;
|
||||||
case MSG_CONNECT:
|
case MSG_CONNECT:
|
||||||
terminate = false;
|
terminate = false;
|
||||||
|
int connection_type;
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(OPTelemetryService.this);
|
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) {
|
switch(connection_type) {
|
||||||
case 0: // No connection
|
case 0: // No connection
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user