From 7cb7bb8170886cec78c11558f7fa9abe95f166b8 Mon Sep 17 00:00:00 2001 From: benfry Date: Mon, 12 Jul 2004 22:06:35 +0000 Subject: [PATCH] fixed bug for empty sketches --- app/PdePreprocessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/PdePreprocessor.java b/app/PdePreprocessor.java index 76d5c9c56..4a82ff9b9 100644 --- a/app/PdePreprocessor.java +++ b/app/PdePreprocessor.java @@ -81,7 +81,8 @@ public class PdePreprocessor { String extraImports[]) throws java.lang.Exception { // if the program ends with no CR or LF an OutOfMemoryError will happen. // not gonna track down the bug now, so here's a hack for it: - if (program.charAt(program.length()-1) != '\n') { + if ((program.length() > 0) && + program.charAt(program.length()-1) != '\n') { program += "\n"; }