Fix check to see if element is there already.
[lhc/web/wiklou.git] / includes / site / SiteArray.php
index 141629e..ad57ed3 100644 (file)
@@ -86,12 +86,12 @@ class SiteArray extends GenericArrayObject implements SiteList {
         * @param mixed $index
         */
        public function offsetUnset( $index ) {
-               /**
-                * @var Site $site
-                */
-               $site = $this->offsetGet( $index );
+               if ( $this->offsetExists( $index ) ) {
+                       /**
+                        * @var Site $site
+                        */
+                       $site = $this->offsetGet( $index );
 
-               if ( $site !== false ) {
                        unset( $this->byGlobalId[$site->getGlobalId()] );
                        unset( $this->byInternalId[$site->getInternalId()] );
                }