diff options
-rw-r--r-- | compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java | 3 | ||||
-rw-r--r-- | compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java index 4228f04dcb..e9a24d040e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/NestedMethodProperty.java @@ -253,6 +253,9 @@ public class NestedMethodProperty<T> extends AbstractProperty<T> { Object object = instance; for (int i = 0; i < getMethods.size() - 1; i++) { object = getMethods.get(i).invoke(object); + if (object == null) { + return; + } } setMethod.invoke(object, new Object[] { value }); } catch (final InvocationTargetException e) { diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java index 96065ae199..82e3fbb86a 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/NestedMethodPropertyTest.java @@ -308,6 +308,12 @@ public class NestedMethodPropertyTest { Address address2 = new Address("Other street", 12345); addressProperty.setValue(address2); assertEquals("Other street", streetProperty.getValue()); + + Address address3 = null; + addressProperty.setValue(address3); + assertEquals(null, addressProperty.getValue()); + streetProperty.setValue("Ruukinkatu"); + assertEquals(null, streetProperty.getValue()); } @Test |