Browse Source

Tag the changes and add null check for pollInputDevices() also.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
9ad3d26a4b
1 changed files with 4 additions and 7 deletions
  1. 4 7
      Source/Android/src/org/libsdl/app/SDLActivity.java

+ 4 - 7
Source/Android/src/org/libsdl/app/SDLActivity.java

@@ -513,18 +513,15 @@ public class SDLActivity extends Activity {
         }
         return Arrays.copyOf(filtered, used);
     }
-            
+
+    // Urho3D: add handler null check
     // Joystick glue code, just a series of stubs that redirect to the SDLJoystickHandler instance
     public static boolean handleJoystickMotionEvent(MotionEvent event) {
-        if (mJoystickHandler != null) {
-            return mJoystickHandler.handleMotionEvent(event);
-        } else {
-            return false;
-        }
+        return mJoystickHandler != null && mJoystickHandler.handleMotionEvent(event); 
     }
     
     public static void pollInputDevices() {
-        if (SDLActivity.mSDLThread != null) {
+        if (SDLActivity.mSDLThread != null && mJoystickHandler != null) {
             mJoystickHandler.pollInputDevices();
         }
     }