Skip to content

Commit

Permalink
拦截删除代码时可能发生的崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
Lin committed Apr 21, 2024
1 parent 8b5ef2e commit cb213ec
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,12 @@ private void drawText(Canvas canvas) {
//postInvalidate();
return;
}
canvas.drawText(text, previousColorPos, visibleCharEnd, paddingLeft + offsetX, lineBaseline, paint);
try {
canvas.drawText(text, previousColorPos, visibleCharEnd, paddingLeft + offsetX, lineBaseline, paint);
} catch (Exception e) {
Log.e(LOG_TAG, String.format("drawText: %s\nPreviousColorPos: %d\nVisibleCharEnd: %d\nX Position: %s\nY Position: %d\nlineStart = %d, lineEnd = %d, visibleCharStart = %d, visibleCharEnd = %d", e, previousColorPos, visibleCharEnd, paddingLeft + offsetX, lineBaseline, lineStart, lineEnd, visibleCharStart, visibleCharEnd));
return;
}
if (DEBUG) {
mLogger.addSplit("draw line " + line + " (" + (visibleCharEnd - visibleCharStart) + ") ");
}
Expand Down Expand Up @@ -438,7 +443,7 @@ public void updateHighlightTokens(JavaScriptHighlighter.HighlightTokens highligh
return;
}
mHighlightTokens = highlightTokens;
Log.d(LOG_TAG, "updateHighlightTokens: tokens = " + highlightTokens);
// Log.d(LOG_TAG, "updateHighlightTokens: tokens = " + highlightTokens);
postInvalidate();
}

Expand Down

0 comments on commit cb213ec

Please sign in to comment.