cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject android commit: Prevent NPE in case webview is lately initialized
Date Mon, 15 Jul 2013 20:35:14 GMT
Updated Branches:
  refs/heads/master 8d8cbf6e2 -> a9ebf50b8


Prevent NPE in case webview is lately initialized


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

Branch: refs/heads/master
Commit: a9ebf50b86bcb9de40cbf4013e98fd1a24be25e8
Parents: 8d8cbf6
Author: denis <denis.vergnes@orange.com>
Authored: Mon Jul 1 15:37:29 2013 +0800
Committer: Joe Bowser <bowserj@apache.org>
Committed: Mon Jul 15 13:34:55 2013 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaActivity.java | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a9ebf50b/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index fd6fc8e..6f9bc91 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -858,8 +858,8 @@ public class CordovaActivity extends Activity implements CordovaInterface
{
         LOG.d(TAG, "Incoming Result");
         super.onActivityResult(requestCode, resultCode, intent);
         Log.d(TAG, "Request code = " + requestCode);
-        ValueCallback<Uri> mUploadMessage = this.appView.getWebChromeClient().getValueCallback();
-        if (requestCode == CordovaChromeClient.FILECHOOSER_RESULTCODE) {
+        if (appView != null && requestCode == CordovaChromeClient.FILECHOOSER_RESULTCODE)
{
+        	ValueCallback<Uri> mUploadMessage = this.appView.getWebChromeClient().getValueCallback();
             Log.d(TAG, "did we get here?");
             if (null == mUploadMessage)
                 return;
@@ -1079,9 +1079,7 @@ public class CordovaActivity extends Activity implements CordovaInterface
{
     @Override
     public boolean onKeyUp(int keyCode, KeyEvent event)
     {
-        //Get whatever has focus!
-        View childView = appView.getFocusedChild();
-        if ((appView.isCustomViewShowing() || childView != null ) &&
+        if (appView != null && (appView.isCustomViewShowing() || appView.getFocusedChild()
!= null ) &&
                 (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU)) {
             return appView.onKeyUp(keyCode, event);
         } else {
@@ -1099,10 +1097,8 @@ public class CordovaActivity extends Activity implements CordovaInterface
{
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event)
     {
-        //Get whatever has focus!
-        View childView = appView.getFocusedChild();
         //Determine if the focus is on the current view or not
-        if (childView != null && (keyCode == KeyEvent.KEYCODE_BACK || keyCode ==
KeyEvent.KEYCODE_MENU)) {
+        if (appView != null && appView.getFocusedChild() != null && (keyCode
== KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU)) {
                     return appView.onKeyDown(keyCode, event);
         }
         else


Mime
View raw message