From 5dc74513ccf8634aad2993b9edb730b13279432e Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 2 Aug 2019 16:43:36 +0000 Subject: [PATCH] Fix a notice when setting a picture description via API --- include/api.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/api.php b/include/api.php index 5665a7fbdd..2c9ae9b387 100644 --- a/include/api.php +++ b/include/api.php @@ -343,11 +343,13 @@ function api_call(App $a) break; case "json": header("Content-Type: application/json"); - $json = json_encode(end($return)); - if (!empty($_GET['callback'])) { - $json = $_GET['callback'] . "(" . $json . ")"; + if (!empty($return)) { + $json = json_encode(end($return)); + if (!empty($_GET['callback'])) { + $json = $_GET['callback'] . "(" . $json . ")"; + } + $return = $json; } - $return = $json; break; case "rss": header("Content-Type: application/rss+xml");