mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
add null check to sketch loading
This commit is contained in:
@@ -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() +
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user