mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 11:21:06 +01:00
Fix exception in preprocessor
Trying to run sketch with setup() without a body would crash the preprocessor. Now it gives correct error message.
This commit is contained in:
@@ -299,13 +299,14 @@ public class PdePreprocessor {
|
||||
MatchResult setupMatch = findInCurrentScope(VOID_SETUP_REGEX, uncommented);
|
||||
if (setupMatch != null) {
|
||||
int start = uncommented.indexOf("{", setupMatch.end());
|
||||
|
||||
// Find a closing brace
|
||||
MatchResult match = findInCurrentScope(CLOSING_BRACE, uncommented, start);
|
||||
if (match != null) {
|
||||
searchArea = uncommented.substring(start + 1, match.end() - 1);
|
||||
} else {
|
||||
throw new SketchException("Found a { that's missing a matching }", false);
|
||||
if (start >= 0) {
|
||||
// Find a closing brace
|
||||
MatchResult match = findInCurrentScope(CLOSING_BRACE, uncommented, start);
|
||||
if (match != null) {
|
||||
searchArea = uncommented.substring(start + 1, match.end() - 1);
|
||||
} else {
|
||||
throw new SketchException("Found a { that's missing a matching }", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user