From 9fa44c35ff5136dbc526a4bd5227e8c353d6d51a Mon Sep 17 00:00:00 2001 From: Jussi Koskela Date: Mon, 20 Aug 2018 09:24:34 +0300 Subject: [PATCH] Check if root allows paste only for non-null target root to prevent NPE gitlab #84 Change-Id: I7d736e78928bc203bfb05e72af31e16d204bdc32 (cherry picked from commit 3a2595f9c5b8a3c6d98add2e869678b26662fde9) --- .../simantics/db/layer0/adapter/impl/DefaultPasteHandler.java | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.1