diff --git a/lib/jcr/find_roots.rb b/lib/jcr/find_roots.rb
index <HASH>..<HASH> 100644
--- a/lib/jcr/find_roots.rb
+++ b/lib/jcr/find_roots.rb
@@ -88,6 +88,7 @@ module JCR
 
   def self.get_rule_by_type rule
     retval = nil
+    return retval unless rule.is_a? Hash
     case
       when rule[:array_rule]
         retval = rule[:array_rule]
diff --git a/spec/find_roots_spec.rb b/spec/find_roots_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/find_roots_spec.rb
+++ b/spec/find_roots_spec.rb
@@ -37,6 +37,18 @@ describe 'find_roots' do
     expect( roots.length ).to eq( 0 )
   end
 
+  it 'should find one root with an empty object rule' do
+    tree = JCR.parse( '{}' )
+    roots = JCR.find_roots( tree )
+    expect( roots.length ).to eq( 1 )
+  end
+
+  it 'should find one root with an empty array rule' do
+    tree = JCR.parse( '[]' )
+    roots = JCR.find_roots( tree )
+    expect( roots.length ).to eq( 1 )
+  end
+
   it 'should find an annotated rule' do
     tree = JCR.parse( '$vrule=: @{root} [ integer* ]' )
     roots = JCR.find_roots( tree )
fixed issue with finding roots with empty objects and arrays