Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[WEEX-303] [Android] fix nullPoint #1106

Merged
merged 1 commit into from Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -58,6 +58,7 @@
import com.taobao.weex.dom.action.TraceableAction;
import com.taobao.weex.tracing.WXTracing;
import com.taobao.weex.ui.WXComponentRegistry;
import com.taobao.weex.ui.component.WXComponent;
import com.taobao.weex.utils.WXExceptionUtils;
import com.taobao.weex.utils.WXFileUtils;
import com.taobao.weex.utils.WXJsonUtils;
Expand Down Expand Up @@ -2510,7 +2511,7 @@ private void doReportJSException(String instanceId, String function, String exce

if (checkEmptyScreen(instance)){
if (WXEnvironment.isApkDebugable()){
WXLogUtils.d("render error 4 js error !");
WXLogUtils.e("render error 4 js error !");
}
WXExceptionUtils.commitCriticalExceptionRT(exceptionId, WXErrorCode.WX_RENDER_ERR_JS_RUNTIME,
function,
Expand All @@ -2529,8 +2530,12 @@ private boolean checkEmptyScreen(WXSDKInstance instance){
if (null == instance || instance.isDestroy()){
return false;
}
WXComponent rootComponent = instance.getRootComponent();
if (null == rootComponent) {
return true;
}

View rootView = instance.getRootView();
View rootView = rootComponent.getRealView();
if (null == rootView){
return true;
}
Expand Down
Expand Up @@ -70,29 +70,19 @@ public WXTimerModule() {
public void setTimeout(@IntRange(from = 1) int funcId, @FloatRange(from = 0) float delay) {
if(mWXSDKInstance != null) {
postOrHoldMessage(MODULE_TIMEOUT, funcId, (int) delay, Integer.parseInt(mWXSDKInstance.getInstanceId()));
WXSDKManager.getInstance().postOnUiThread(new Runnable() {
@Override
public void run() {
if (null != mWXSDKInstance){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
},0);
if (null != mWXSDKInstance.getWXPerformance()){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
}

@JSMethod(uiThread = false)
public void setInterval(@IntRange(from = 1) int funcId, @FloatRange(from = 0) float interval) {
if(mWXSDKInstance != null) {
postOrHoldMessage(MODULE_INTERVAL, funcId, (int) interval, Integer.parseInt(mWXSDKInstance.getInstanceId()));
WXSDKManager.getInstance().postOnUiThread(new Runnable() {
@Override
public void run() {
if (null != mWXSDKInstance){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
},0);
if (null != mWXSDKInstance.getWXPerformance()){
mWXSDKInstance.getWXPerformance().timerInvokeCount++;
}
}
}

Expand Down