From 736bc489e64e58ed205d2d1e60411a4b54b005c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Bl=C3=A4ul?= Date: Sun, 18 Feb 2018 19:01:47 +0100 Subject: [PATCH] getDatatypes: throw more meaningful exception if no data is present --- extensions/DatatypeTrait.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extensions/DatatypeTrait.php b/extensions/DatatypeTrait.php index 7d5359f..cf48489 100644 --- a/extensions/DatatypeTrait.php +++ b/extensions/DatatypeTrait.php @@ -74,12 +74,17 @@ trait DatatypeTrait { * * @access public * + * @uses getDatatypeFromString + * * @return array|bool */ public function getDatatypes() { if (empty($this->data)) { $this->data = $this->parse_string(); } + if (!is_array($this->data)) { + throw new \Exception('No data set yet.'); + } $result = []; foreach ($this->titles as $cName) {