From: Jussi Koskela Date: Mon, 20 Aug 2018 06:24:34 +0000 (+0300) Subject: Check if root allows paste only for non-null target root to prevent NPE X-Git-Tag: v1.43.0~136^2~406 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=3a2595f9c5b8a3c6d98add2e869678b26662fde9;p=simantics%2Fplatform.git Check if root allows paste only for non-null target root to prevent NPE gitlab #84 Change-Id: I7d736e78928bc203bfb05e72af31e16d204bdc32 --- diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/DefaultPasteHandler.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/DefaultPasteHandler.java index 067ed9207..44aea9ad9 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/DefaultPasteHandler.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/DefaultPasteHandler.java @@ -185,6 +185,8 @@ public class DefaultPasteHandler extends PasteHandlerAdapter { } protected void checkIfRootAllowsPaste(ReadGraph graph) throws DatabaseException { + if (resource == null) + return; Layer0 L0 = Layer0.getInstance(graph); // check if root is published Boolean published = graph.getPossibleRelatedValue(resource, L0.Entity_published);