Check if $rr exists

This commit is contained in:
Hauke Zuehl 2012-06-16 15:07:23 +02:00
parent 64b4bbd65d
commit 1231dd72f0

View file

@ -18,9 +18,7 @@
if(! function_exists('load_config')) { if(! function_exists('load_config')) {
function load_config($family) { function load_config($family) {
global $a; global $a;
$r = q("SELECT * FROM `config` WHERE `cat` = '%s'", $r = q("SELECT * FROM `config` WHERE `cat` = '%s'", dbesc($family));
dbesc($family)
);
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$k = $rr['k']; $k = $rr['k'];
@ -30,7 +28,7 @@ function load_config($family) {
$a->config[$family][$k] = $rr['v']; $a->config[$family][$k] = $rr['v'];
} }
} }
} else if ($rr['cat'] != 'config') { } else if (isset($rr) && ($rr['cat'] != 'config')) {
// Negative caching // Negative caching
$a->config[$family] = "!<unset>!"; $a->config[$family] = "!<unset>!";
} }