diff --git a/app/src/processing/app/SketchCode.java b/app/src/processing/app/SketchCode.java index 1a52bfb9e..59ed06652 100644 --- a/app/src/processing/app/SketchCode.java +++ b/app/src/processing/app/SketchCode.java @@ -283,6 +283,12 @@ public class SketchCode { public void load() throws IOException { program = Util.loadFile(file); + if (program == null) { + System.err.println("There was a problem loading " + file); + System.err.println("This may happen because you don't have permissions to read the file, or the file has gone missing."); + throw new IOException("Cannot read or access " + file); + } + // Remove NUL characters because they'll cause problems, // and their presence is very difficult to debug. // https://github.com/processing/processing/issues/1973 @@ -292,7 +298,7 @@ public class SketchCode { savedProgram = program; // This used to be the "Fix Encoding and Reload" warning, but since that - // tool has been removed, it just rambles about text editors and encodings. + // tool has been removed, let's ramble about text editors and encodings. if (program.indexOf('\uFFFD') != -1) { System.err.println(file.getName() + " contains unrecognized characters."); System.err.println("You should re-open " + file.getName() + diff --git a/todo.txt b/todo.txt index 9a0b872e8..d2d53b11c 100755 --- a/todo.txt +++ b/todo.txt @@ -14,6 +14,8 @@ X 'run sketches on display' message shows up on clean install X should ant run launch the .app so that launchsvcs stuff works properly? X double-clicking a .pde file won't open the app correctly X add 'ant app' target, at least for macOS +X add null check to sketch loading +X discovered during https://github.com/processing/processing/issues/4980 gohai X IO library updates