Skip to content

Commit 9baf4a9

Browse files
TatuLundAnsku
authored andcommitted
Eliminate un-intuitive NPE (#11802)
* Eliminate un-intuitive NPE Fixes #10947
1 parent debfc3b commit 9baf4a9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/src/main/java/com/vaadin/ui/renderers/TextRenderer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ public TextRenderer(String nullRepresentation) {
5252
public JsonValue encode(Object value) {
5353
if (value == null) {
5454
return super.encode(null);
55-
} else {
56-
return Json.create(value.toString());
5755
}
56+
String stringValue = value.toString();
57+
if (stringValue == null) {
58+
return super.encode(null);
59+
}
60+
return Json.create(stringValue);
5861
}
5962

6063
@Override

0 commit comments

Comments
 (0)