${h.breakableString(…)} might be called with a null argument if something is broken.

For robustness, pass on the null to Jelly rather than failing page rendering.
This commit is contained in:
Jesse Glick committed 2014-04-30 18:19:17 -04:00
1 parent 87e66570b8
commit 3f2958795c
2 files changed
+5 -2

No files matched your search

+3 -1
View File
@@ -1828,7 +1828,9 @@ public class Functions {
* @since 1.517
*/
public static String breakableString(final String plain) {
if (plain == null) {
return null;
}
return plain.replaceAll("([\\p{Punct}&&[^;]]+\\w)", "<wbr>$1")
.replaceAll("([^\\p{Punct}\\s-]{20})(?=[^\\p{Punct}\\s-]{10})", "$1<wbr>")
;