aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authormlindfors <majuli@vaadin.com>2019-02-04 13:54:09 +0200
committerSun Zhe <31067185+ZheSun88@users.noreply.github.com>2019-03-06 10:30:35 +0200
commite6a301851d0b8b7e52d7b17ca4fa041140bc87c5 (patch)
tree751b3de1aa95457875aa94a54e4b927d4dfbcea9 /server
parentfa6a898dec77207bb942d5a03e4088e11071767d (diff)
downloadvaadin-framework-e6a301851d0b8b7e52d7b17ca4fa041140bc87c5.tar.gz
vaadin-framework-e6a301851d0b8b7e52d7b17ca4fa041140bc87c5.zip
Fix an NPE caused by the previous fix to Grid's frozen columns (#11444)
* Fix an NPE caused by the previous fix to Grid's frozen columns (#10653) If the user managed to get two frozen column count changes into a single server round-trip before the component had been attached, the previous fix #11346 lead to a null pointer exception since there was no diff state available. This fix adds a null check before removing the frozen column count value from the diff state so that this will not happen. Closes #10653
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 7c3467eaa3..3d687136cd 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -3093,8 +3093,12 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents,
final String diffStateKey = "frozenColumnCount";
UI ui = getUI();
if (ui != null) {
- ui.getConnectorTracker().getDiffState(Grid.this)
- .remove(diffStateKey);
+ JsonObject diffState = ui.getConnectorTracker()
+ .getDiffState(Grid.this);
+ // if diffState is not present, there's nothing for us to clean
+ if (diffState != null) {
+ diffState.remove(diffStateKey);
+ }
}
}
getState().frozenColumnCount = numberOfColumns;