From ba15420ab5a49d6e38b5f0be12798026a5ac6cee Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Tue, 12 Jul 2016 01:29:42 +0200
Subject: [PATCH] Fix fatal error:  Call to a member function isNoShipping() on
 a non-object ...

---
 library/rules_shipping_framework.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/library/rules_shipping_framework.php b/library/rules_shipping_framework.php
index 73e9b6e..8841f2a 100644
--- a/library/rules_shipping_framework.php
+++ b/library/rules_shipping_framework.php
@@ -425,7 +425,7 @@ class RulesShippingFramework {
 			}
 		}
 		// None of the rules matched, so return NULL, but keep the evaluated results;
-		$this->match[$id] = $result;
+		$this->match[$id] = NULL;
 		return NULL;
 	}
 
@@ -453,7 +453,7 @@ class RulesShippingFramework {
 			$this->parseMethodRules($method);
 		// TODO: This needs to be redone sooner or later!
 		$match = $this->evaluateMethodRules ($cart, $method);
-		if ($match && !is_null ($match['rule'])) {
+		if ($match && isset($match['rule']) && !is_null ($match['rule'])) {
 			$this->setMethodCosts($method, $match, null);
 			// If NoShipping is set, this method should NOT offer any shipping at all, so return FALSE, otherwise TRUE
 			// If the rule has a name, print it as warning (otherwise don't print anything)
@@ -484,7 +484,7 @@ class RulesShippingFramework {
 		if (!isset($this->rules[$id])) 
 			$this->parseMethodRules($method);
 		$match = $this->evaluateMethodRules ($cart, $method);
-		if ($match) {
+		if ($match && isset($match['rule']) && !is_null ($match['rule'])) {
 			if ($this->handleNoShipping($match, $method)) {
 				return $results;
 			}
-- 
GitLab