* [android] add NPE protection

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

Branch: refs/heads/master
Commit: fd246676302bdce2313608fb21ac79d6a01a9dde
Parents: 060d89a
Author: atomtong <tong_huab...@qq.com>
Authored: Wed Nov 15 11:24:54 2017 +0800
Committer: atomtong <tong_huab...@qq.com>
Committed: Wed Nov 15 11:24:54 2017 +0800

----------------------------------------------------------------------
 .../sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/fd246676/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java 
b/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
index 70ca32b..f6439bc 100644
--- a/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
+++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXLogUtils.java
@@ -123,9 +123,10 @@ public class WXLogUtils {
 
   public static void d(String tag, String msg) {
 
-       log(tag, msg, LogLevel.DEBUG);
+       if(!TextUtils.isEmpty(tag) && !TextUtils.isEmpty(msg)){
+         log(tag, msg, LogLevel.DEBUG);
 
-       if(WXEnvironment.isApkDebugable()){//sLogLevel in debug mode is 
"LogLevel.DEBUG"
+         if(WXEnvironment.isApkDebugable()){//sLogLevel in debug mode is 
"LogLevel.DEBUG"
                if ("jsLog".equals(tag) && jsLogWatcher != null) {
                  if (msg.endsWith("__DEBUG")) {
                        jsLogWatcher.onJsLog(Log.DEBUG, msg.replace("__DEBUG", 
""));
@@ -151,7 +152,8 @@ public class WXLogUtils {
                        return;
                  }
                }
-         sendLog(LogLevel.DEBUG, tag + ":" + msg);// WXDebugTool sendLog
+               sendLog(LogLevel.DEBUG, tag + ":" + msg);// WXDebugTool sendLog
+         }
        }
   }
 

Reply via email to