You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by lu...@apache.org on 2019/08/21 11:55:30 UTC

[incubator-weex] branch master updated: Fix npe (#2842)

This is an automated email from the ASF dual-hosted git repository.

luckychen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new f64a866  Fix npe (#2842)
f64a866 is described below

commit f64a8660887c6767d6ec7fc927b58871661bd751
Author: darin <dy...@qq.com>
AuthorDate: Wed Aug 21 19:55:23 2019 +0800

    Fix npe (#2842)
---
 weex_core/Source/android/bridge/script_bridge_in_multi_process.cpp | 6 +++---
 weex_core/Source/android/jsengine/weex_jsc_utils.cpp               | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/weex_core/Source/android/bridge/script_bridge_in_multi_process.cpp b/weex_core/Source/android/bridge/script_bridge_in_multi_process.cpp
index 524a9e6..96ca9f0 100644
--- a/weex_core/Source/android/bridge/script_bridge_in_multi_process.cpp
+++ b/weex_core/Source/android/bridge/script_bridge_in_multi_process.cpp
@@ -72,9 +72,9 @@ static std::unique_ptr<IPCResult> HandleReportException(
   }
 
   WeexCoreManager::Instance()->script_thread()->message_loop()->PostTask(
-      weex::base::MakeCopyable([pageId = std::string(pageId),
-                                funcS = std::string(func),
-                                exceptionStr = std::string(exceptionInfo)] {
+      weex::base::MakeCopyable([pageId = std::string(pageId == nullptr ? "" : pageId),
+                                funcS = std::string(func == nullptr ? "" : func),
+                                exceptionStr = std::string(exceptionInfo == nullptr ? "" : exceptionInfo)] {
         WeexCoreManager::Instance()
             ->script_bridge()
             ->core_side()
diff --git a/weex_core/Source/android/jsengine/weex_jsc_utils.cpp b/weex_core/Source/android/jsengine/weex_jsc_utils.cpp
index f1182a0..2db4bb9 100644
--- a/weex_core/Source/android/jsengine/weex_jsc_utils.cpp
+++ b/weex_core/Source/android/jsengine/weex_jsc_utils.cpp
@@ -540,7 +540,8 @@ void ReportException(JSGlobalObject *_globalObject, Exception *exception, const
     CString data = exceptionInfo.utf8();
 
     auto *globalObject = static_cast<WeexGlobalObject *>(_globalObject);
-    globalObject->js_bridge()->core_side()->ReportException(instanceid, func, data.data());
+    const char *exception_char = data.data();
+    globalObject->js_bridge()->core_side()->ReportException(instanceid, func, exception_char == nullptr? "" : exception_char);
 }