incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [3/50] git commit: Fix NullPointerException in DroidGap.onMeasure()
Date Tue, 03 Jan 2012 18:57:08 GMT
Fix NullPointerException in DroidGap.onMeasure()

It looks like on some devices the onMeasure() method is called before the callbackServer is
instantiated. This causes a NullPointerException which kills the application.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/fae551f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/fae551f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/fae551f0

Branch: refs/heads/master
Commit: fae551f0cea22c9843911cdcc2472b4e8135c93d
Parents: 1511183
Author: macdonst <simon.macdonald@gmail.com>
Authored: Thu Dec 22 09:47:40 2011 +0800
Committer: macdonst <simon.macdonald@gmail.com>
Committed: Thu Dec 22 09:51:11 2011 +0800

----------------------------------------------------------------------
 framework/src/com/phonegap/DroidGap.java |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/fae551f0/framework/src/com/phonegap/DroidGap.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java
index 26a04f5..f906567 100755
--- a/framework/src/com/phonegap/DroidGap.java
+++ b/framework/src/com/phonegap/DroidGap.java
@@ -1695,14 +1695,18 @@ public class DroidGap extends PhonegapActivity {
                 // If the height as gotten bigger then we will assume the soft keyboard has

                 // gone away.
                 else if (height > oldHeight) {
-                    LOG.v(TAG, "Throw hide keyboard event");
-                    callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('hidekeyboard');");
+                    if (callbackServer != null) {
+                        LOG.v(TAG, "Throw hide keyboard event");
+                        callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('hidekeyboard');");
+                    }
                 } 
                 // If the height as gotten smaller then we will assume the soft keyboard
has 
                 // been displayed.
                 else if (height < oldHeight) {
-                    LOG.v(TAG, "Throw show keyboard event");
-                    callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('showkeyboard');");
+                    if (callbackServer != null) {
+                        LOG.v(TAG, "Throw show keyboard event");
+                        callbackServer.sendJavascript("PhoneGap.fireDocumentEvent('showkeyboard');");
+                    }
                 }
 
                 // Update the old height for the next event


Mime
View raw message