From 1f871298705b9ce4e7c4d9a088efb97d5ba589de Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 16 Jan 2017 16:41:54 -0600 Subject: [PATCH] Don't iterate if object is null - Fixes #766. --- lib/PayPal/Common/PayPalResourceModel.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/PayPal/Common/PayPalResourceModel.php b/lib/PayPal/Common/PayPalResourceModel.php index 927a379..6b40e8f 100644 --- a/lib/PayPal/Common/PayPalResourceModel.php +++ b/lib/PayPal/Common/PayPalResourceModel.php @@ -41,9 +41,11 @@ class PayPalResourceModel extends PayPalModel implements IResource public function getLink($rel) { - foreach ($this->links as $link) { - if ($link->getRel() == $rel) { - return $link->getHref(); + if ($this->links) { + foreach ($this->links as $link) { + if ($link->getRel() == $rel) { + return $link->getHref(); + } } } return null;