Created
March 11, 2009 04:01
-
-
Save jashkenas/77302 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: core/src/processing/core/PApplet.java | |
=================================================================== | |
--- core/src/processing/core/PApplet.java (revision 5371) | |
+++ core/src/processing/core/PApplet.java (working copy) | |
@@ -1386,7 +1386,22 @@ | |
} catch (RendererChangeException e) { | |
// Give up, instead set the new renderer and re-attempt setup() | |
return; | |
+ | |
+ // Catch a JRuby exception so that the RendererChangeExceptions | |
+ // that we're looking for don't get stuck in Ruby-space. | |
+ } catch (RuntimeException e) { | |
+ String message = e.getMessage(); | |
+ String name = RendererChangeException.class.getName(); | |
+ String regex = "(?s).*" + name + ".*"; | |
+ regex = regex.replace("$", "\\$"); | |
+ if (message != null && message.matches(regex)) { | |
+ // Give up, instead set the new renderer and re-attempt setup() | |
+ return; | |
+ } else { | |
+ throw e; | |
+ } | |
} | |
+ | |
this.defaultSize = false; | |
} else { // frameCount > 0, meaning an actual draw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment