diff options
author | Skylion007 <dragonsrcool.aaron@gmail.com> | 2013-08-31 22:12:30 +0400 |
---|---|---|
committer | Skylion007 <dragonsrcool.aaron@gmail.com> | 2013-08-31 22:12:30 +0400 |
commit | 28fcf79a4bad1a8eb48a3517261bfff9f7758654 (patch) | |
tree | c317d979bd332ba4d4162aaeda69ec3a5a5ed3f6 | |
parent | 272a0ee7de2e3f4663c1c6c505404a4afa561780 (diff) |
Parsing Bugfix
Fixed exceedingly rare parsing error which caused a Stack Overflow Exception if the only space or punctuation was located at index 0.
-rw-r--r-- | src/com/darkprograms/speech/synthesiser/Synthesiser.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/darkprograms/speech/synthesiser/Synthesiser.java b/src/com/darkprograms/speech/synthesiser/Synthesiser.java index d304df8..ddedfea 100644 --- a/src/com/darkprograms/speech/synthesiser/Synthesiser.java +++ b/src/com/darkprograms/speech/synthesiser/Synthesiser.java @@ -158,7 +158,7 @@ public class Synthesiser { } else{ int lastWord = findLastWord(input);//Checks if a space exists - if(lastWord<0){ + if(lastWord<=0){ fragments.add(input.substring(0,100));//In case you sent gibberish to Google. return parseString(input.substring(100), fragments); }else{ @@ -181,7 +181,7 @@ public class Synthesiser { for(int i = 99; i>=0; i--){ char tmp = input.charAt(i); if(isEndingPunctuation(tmp)){ - return i; + return i+1; } if(space==-1 && tmp == ' '){ space = i; |