]> Repositorios git - scryer-prolog.git/commitdiff
Handled the empty case (#770)
authornotoria <[email protected]>
Sun, 31 Jan 2021 10:03:17 +0000 (11:03 +0100)
committernotoria <[email protected]>
Sun, 31 Jan 2021 10:03:17 +0000 (11:03 +0100)
src/forms.rs

index be572bc4c9c6cc89387f4281f260c06f14c33ccc..b99897a17717e41df972fe2f8383cb9ad1e79c64 100644 (file)
@@ -341,7 +341,13 @@ impl PredicateClause {
                     _ => None,
                 }
             },
-            PredicateClause::Rule(ref rule, ..) => Some(&rule.head.1),
+            PredicateClause::Rule(ref rule, ..) => {
+                if rule.head.1.is_empty() {
+                    None
+                } else {
+                    Some(&rule.head.1)
+                }
+            }
         }
     }