incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r918488 - /sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java
Date Wed, 03 Mar 2010 14:36:10 GMT
Author: bdelacretaz
Date: Wed Mar  3 14:36:09 2010
New Revision: 918488

URL: http://svn.apache.org/viewvc?rev=918488&view=rev
Log:
SLING-1423 - avoid NPE if no Resource is provided

Modified:
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java?rev=918488&r1=918487&r2=918488&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/scripting/CurrentNodeBindingsValuesProvider.java
Wed Mar  3 14:36:09 2010
@@ -38,10 +38,11 @@
      */
     public void addBindings(Bindings bindings) {
         Resource resource = (Resource) bindings.get("resource");
-        Node node = resource.adaptTo(Node.class);
-        if (node != null) {
-            bindings.put("currentNode", node);
+        if(resource != null) {
+            Node node = resource.adaptTo(Node.class);
+            if (node != null) {
+                bindings.put("currentNode", node);
+            }
         }
-
     }
 }



Mime
View raw message