Skip to content

Commit 27f54c6

Browse files
committed
Response: check if empty response before attempting to decode
1 parent 2c8dfee commit 27f54c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DatingVIP/API/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function set($data)
100100

101101
case 'json':
102102
default:
103-
$this->data = json_decode($data, true) ?: [];
103+
$this->data = empty($data) ? [] : (json_decode($data, true) ?: []);
104104
$result = json_last_error() == JSON_ERROR_NONE;
105105
if (empty ($result)) {
106106
throw new RuntimeException ("Error decoding: " . json_last_error_msg ());

0 commit comments

Comments
 (0)