--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/MainActivity.java Fri Dec 06 22:20:53 2019 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/MainActivity.java Sat Dec 07 16:14:27 2019 +0100
@@ -103,10 +103,14 @@
broadcastManager.unregisterReceiver(connectedReceiver);
broadcastManager.unregisterReceiver(connectionFailedReceiver);
broadcastManager.unregisterReceiver(passwordRequestedReceiver);
- Netplay netplay = Netplay.getAppInstance(getApplicationContext());
- if(netplay.getState() == State.CONNECTING) {
- netplay.disconnect();
+ // disable netplay for now
+ if (Netplay.hasAppInstance()) {
+ Netplay netplay = Netplay.getAppInstance(getApplicationContext());
+ if(netplay.getState() == State.CONNECTING) {
+ netplay.disconnect();
+ }
}
+
}
@Override
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/Netplay.java Fri Dec 06 22:20:53 2019 +0100
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/Netplay.java Sat Dec 07 16:14:27 2019 +0100
@@ -188,6 +188,10 @@
private static Netplay instance;
+ public static boolean hasAppInstance() {
+ return instance != null;
+ }
+
/**
* Retrieve the single app-wide instance of the netplay interface, creating it if it
* does not exist yet.
@@ -196,7 +200,7 @@
* @return
*/
public static Netplay getAppInstance(Context applicationContext) {
- if(instance == null) {
+ if (!hasAppInstance()) {
// We will need some default values for rooms, best load them here
Scheme defaultScheme = null;
Weaponset defaultWeaponset = null;