修复 一些崩溃问题

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

View File

@@ -70,7 +70,12 @@ public class ScreenCapturer {
int orientation = mContext.getResources().getConfiguration().orientation;
if (mOrientation == ORIENTATION_AUTO && mDetectedOrientation != orientation) {
mDetectedOrientation = orientation;
refreshVirtualDisplay(orientation);
try {
refreshVirtualDisplay(orientation);
}catch (Exception e){
e.printStackTrace();
mException = e;
}
}
}
@@ -148,8 +153,8 @@ public class ScreenCapturer {
@Nullable
public Image capture() {
if (mException != null) {
Exception e = mException;
Exception e = mException;
if (e != null) {
mException = null;
throw new ScriptException(e);
}

View File

@@ -1,6 +1,6 @@
{
"appVersionCode": 439,
"appVersionName": "4.0.4 Alpha10",
"appVersionCode": 440,
"appVersionName": "4.0.4 Alpha11",
"target": 28,
"mini": 17,
"compile": 28,