From 50c16c394fe2d966c62d30930600212a4e33303e Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 1 Nov 2014 01:52:27 -0700 Subject: check that we have valid data --- mod/post.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'mod/post.php') diff --git a/mod/post.php b/mod/post.php index 8ffd3b5ad..c21af83e4 100644 --- a/mod/post.php +++ b/mod/post.php @@ -598,18 +598,24 @@ function post_post(&$a) { $ret['success'] = true; $ret['pickup'] = array(); foreach($r as $rr) { - $x = json_decode($rr['outq_msg'],true); + if($rr['outq_msg']) { + $x = json_decode($rr['outq_msg'],true); - if(array_key_exists('message_list',$x)) { - foreach($x['message_list'] as $xx) - $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $xx); - } - else - $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $x); + if(! $x) + continue; - $x = q("delete from outq where outq_hash = '%s' limit 1", - dbesc($rr['outq_hash']) - ); + if(array_key_exists('message_list',$x)) { + foreach($x['message_list'] as $xx) { + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $xx); + } + } + else + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $x); + + $x = q("delete from outq where outq_hash = '%s' limit 1", + dbesc($rr['outq_hash']) + ); + } } } -- cgit v1.2.3