diff --git a/lib-n-ide/src/main/java/com/jecelyin/editor/v2/editor/Document.java b/lib-n-ide/src/main/java/com/jecelyin/editor/v2/editor/Document.java index e7c69681..882e1e2e 100644 --- a/lib-n-ide/src/main/java/com/jecelyin/editor/v2/editor/Document.java +++ b/lib-n-ide/src/main/java/com/jecelyin/editor/v2/editor/Document.java @@ -151,7 +151,7 @@ public void onStart() { @Override public SpannableStringBuilder onAsyncReaded(FileReader fileReader, boolean ok) { - Editable text = fileReader.getBuffer(); + CharSequence text = fileReader.getBuffer(); String firstLine = text.subSequence(0, Math.min(80, text.length())).toString(); ModeProvider modeProvider = ModeProvider.getInstance(); diff --git a/lib-n-ide/src/main/java/com/jecelyin/editor/v2/io/FileReader.java b/lib-n-ide/src/main/java/com/jecelyin/editor/v2/io/FileReader.java index 5faf2a07..80336f4f 100644 --- a/lib-n-ide/src/main/java/com/jecelyin/editor/v2/io/FileReader.java +++ b/lib-n-ide/src/main/java/com/jecelyin/editor/v2/io/FileReader.java @@ -66,6 +66,8 @@ public boolean read() { } catch (Exception e) { DLog.e(e); return false; + } catch (OutOfMemoryError error) { + return false; } }