incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bcur...@apache.org
Subject android commit: Fix exception when plugin returns a null string.
Date Wed, 24 Oct 2012 18:37:39 GMT
Updated Branches:
  refs/heads/master 7d3afcab9 -> cba0d5902


Fix exception when plugin returns a null string.


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/cba0d590
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/cba0d590
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/cba0d590

Branch: refs/heads/master
Commit: cba0d59021a2562af6888050a171d4ba3cdbe47e
Parents: 7d3afca
Author: Bryce Curtis <curtis.bryce@gmail.com>
Authored: Wed Oct 24 12:36:30 2012 -0600
Committer: Bryce Curtis <curtis.bryce@gmail.com>
Committed: Wed Oct 24 12:36:30 2012 -0600

----------------------------------------------------------------------
 .../org/apache/cordova/NativeToJsMessageQueue.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/cba0d590/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
index 55fa205..03a69b1 100755
--- a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
+++ b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
@@ -398,7 +398,12 @@ public class NativeToJsMessageQueue {
                     ret += 1 + pluginResult.getMessage().length();
                     break;
                 case PluginResult.MESSAGE_TYPE_STRING: // s
-                    ret += 1 + pluginResult.getStrMessage().length();
+                    if (pluginResult.getStrMessage() == null) {
+                        ret += 1;
+                    }
+                    else {
+                        ret += 1 + pluginResult.getStrMessage().length();
+                    }
                     break;
                 case PluginResult.MESSAGE_TYPE_JSON:
                 default:
@@ -433,8 +438,10 @@ public class NativeToJsMessageQueue {
                       .append(pluginResult.getMessage());
                     break;
                 case PluginResult.MESSAGE_TYPE_STRING: // s
-                    sb.append('s')
-                      .append(pluginResult.getStrMessage());
+                    sb.append('s');
+                    if (pluginResult.getStrMessage() != null) {
+                        sb.append(pluginResult.getStrMessage());
+                    }
                     break;
                 case PluginResult.MESSAGE_TYPE_JSON:
                 default:


Mime
View raw message