aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatu Lund <tatu@vaadin.com>2019-11-15 16:04:43 +0200
committerAnna Koskinen <Ansku@users.noreply.github.com>2019-11-15 16:04:43 +0200
commit9baf4a9c26d5129ae274cfd3ce1da0e68bb5c78b (patch)
tree6a17aada2dabbd991d4b6315b644db4014c8b4c5
parentdebfc3b0385e931a4cb4d694c61223674c2413c2 (diff)
downloadvaadin-framework-9baf4a9c26d5129ae274cfd3ce1da0e68bb5c78b.tar.gz
vaadin-framework-9baf4a9c26d5129ae274cfd3ce1da0e68bb5c78b.zip
Eliminate un-intuitive NPE (#11802)
* Eliminate un-intuitive NPE Fixes https://github.com/vaadin/framework/issues/10947
-rw-r--r--server/src/main/java/com/vaadin/ui/renderers/TextRenderer.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/src/main/java/com/vaadin/ui/renderers/TextRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/TextRenderer.java
index 94fbef613d..5c074d774c 100644
--- a/server/src/main/java/com/vaadin/ui/renderers/TextRenderer.java
+++ b/server/src/main/java/com/vaadin/ui/renderers/TextRenderer.java
@@ -52,9 +52,12 @@ public class TextRenderer extends AbstractRenderer<Object, Object> {
public JsonValue encode(Object value) {
if (value == null) {
return super.encode(null);
- } else {
- return Json.create(value.toString());
}
+ String stringValue = value.toString();
+ if (stringValue == null) {
+ return super.encode(null);
+ }
+ return Json.create(stringValue);
}
@Override