Auto-Wrap Label crashes the application if it's shrunken into zero-lengt

This commit is contained in:
bancika
2021-01-09 10:05:10 +01:00
parent 5835d18a21
commit 751f6493cd
2 changed files with 10 additions and 0 deletions
@@ -3490,6 +3490,10 @@
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Improved code robustness</description> <description>Improved code robustness</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Auto-Wrap Label crashes the application if it's shrunken into zero-length</description>
</org.diylc.appframework.update.Change>
</changes> </changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url> <url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version> </org.diylc.appframework.update.Version>
@@ -113,6 +113,12 @@ public class StringUtils {
if (pos == -1) if (pos == -1)
pos = guess; // Split in the middle of the word pos = guess; // Split in the middle of the word
// if we couldn't find a match, expand maxWidth
if (pos <= 0) {
maxWidth++;
continue;
}
list.add(line.substring(0, pos).trim()); list.add(line.substring(0, pos).trim());
line = line.substring(pos).trim(); line = line.substring(pos).trim();
len = line.length(); len = line.length();