From: Michael Date: Tue, 18 Apr 2017 18:50:01 +0000 (+0000) Subject: Handle the case when the given contact url or address is empty X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=828ae671f049b488c5154d364dab8eb9f236d4ea;p=friendica.git Handle the case when the given contact url or address is empty --- diff --git a/include/Contact.php b/include/Contact.php index 4e86b32977..6f662cdf15 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -212,6 +212,10 @@ function unmark_for_death($contact) { function get_contact_details_by_url($url, $uid = -1, $default = array()) { static $cache = array(); + if ($url == '') { + return $default; + } + if ($uid == -1) { $uid = local_user(); } @@ -328,6 +332,10 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) { function get_contact_details_by_addr($addr, $uid = -1) { static $cache = array(); + if ($addr == '') { + return array(); + } + if ($uid == -1) { $uid = local_user(); } @@ -534,6 +542,10 @@ function get_contact($url, $uid = 0, $no_update = false) { $data = array(); $contact_id = 0; + if ($url == '') { + return 0; + } + // We first try the nurl (http://server.tld/nick), most common case $contacts = q("SELECT `id`, `avatar-date` FROM `contact` WHERE `nurl` = '%s'