]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Check if root allows paste only for non-null target root to prevent NPE 41/2041/1
authorJussi Koskela <jussi.koskela@semantum.fi>
Mon, 20 Aug 2018 06:24:34 +0000 (09:24 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 28 Aug 2018 09:07:18 +0000 (09:07 +0000)
gitlab #84

Change-Id: I7d736e78928bc203bfb05e72af31e16d204bdc32
(cherry picked from commit 3a2595f9c5b8a3c6d98add2e869678b26662fde9)

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/DefaultPasteHandler.java

index 067ed9207fe4d224f2add76b0ae00d71e098b51d..44aea9ad91a6d5f58db238b1c3a56469763e2713 100644 (file)
@@ -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);