修复 一些崩溃问题

This commit is contained in:
hyb1996
2018-11-20 23:43:19 +08:00
parent 3835c9d4a9
commit 955433ae00
6 changed files with 23 additions and 9 deletions

View File

@@ -52,7 +52,10 @@ public class AutoJs extends com.stardust.autojs.AutoJs {
}
public static void initInstance(Application application) {
public synchronized static void initInstance(Application application) {
if (instance != null) {
return;
}
instance = new AutoJs(application);
}

View File

@@ -40,7 +40,7 @@ public class JavaScriptHighlighter implements SimpleTextWatcher.AfterTextChanged
}
public void addToken(int tokenStart, int tokenEnd, int color) {
if(mCount < tokenStart){
if (mCount < tokenStart) {
int c = mCount > 0 ? colors[mCount - 1] : color;
for (int i = mCount; i < tokenStart; i++) {
colors[i] = c;
@@ -93,10 +93,13 @@ public class JavaScriptHighlighter implements SimpleTextWatcher.AfterTextChanged
}
public void updateTokens(String sourceString) {
if(mTheme == null){
if (mTheme == null) {
return;
}
final int id = mRunningHighlighterId.incrementAndGet();
if (mExecutorService.isShutdown() || mExecutorService.isTerminated() || mExecutorService.isTerminating()) {
return;
}
mExecutorService.execute(() -> {
try {
mLogger.reset();

View File

@@ -168,6 +168,9 @@ public class ExplorerView extends ThemeColorSwipeRefreshLayout implements SwipeR
Stack<ScriptFile> dirs = new Stack<>();
while (!dir.equals(root)) {
dir = dir.getParentFile();
if (dir == null) {
break;
}
dirs.push(dir);
}
ExplorerDirPage parent = null;

View File

@@ -117,7 +117,7 @@ public class CommunityFragment extends ViewPagerFragment implements BackPressedH
private boolean isInPostsPage() {
String url = mWebView.getUrl();
return url.matches(POSTS_PAGE_PATTERN);
return url != null && url.matches(POSTS_PAGE_PATTERN);
}
@Override