]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Occasionally we'd get a false from Profile::getKV
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 3 Jul 2014 09:55:24 +0000 (11:55 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 3 Jul 2014 09:55:24 +0000 (11:55 +0200)
Due to cache miss? Probably, but now we simply say that it's null in that case
so we get a proper exception from Notice::_setProfiles

classes/Notice.php

index ebf874bffb5d829f28b62fc2c55ebba421731975..74f2f6aa912d20ce4a4e1af8a4314936385f5903 100644 (file)
@@ -150,7 +150,10 @@ class Notice extends Managed_DataObject
     public function getProfile()
     {
         if (!isset($this->_profile[$this->profile_id])) {
-            $this->_setProfile(Profile::getKV('id', $this->profile_id));
+            // We could've sent getKV directly to _setProfile, but occasionally we get
+            // a "false" (instead of null), likely because it indicates a cache miss.
+            $profile = Profile::getKV('id', $this->profile_id);
+            $this->_setProfile($profile instanceof Profile ? $profile : null);
         }
         return $this->_profile[$this->profile_id];
     }