Commit d483a931 authored by Ana Rute Mendes's avatar Ana Rute Mendes 🌈
Browse files

LOCAL: Validate variables before calling functions

Some customization are not being used in Phabricator Apertis
instance. So some features were breaking when calling functions
in variables that were null
parent 6e3a2a5a
...@@ -366,7 +366,10 @@ final class ManiphestTransactionEditor ...@@ -366,7 +366,10 @@ final class ManiphestTransactionEditor
array $xactions) { array $xactions) {
$this->setContinueOnNoEffect(true); $this->setContinueOnNoEffect(true);
$snipe_api = new SnipeItHelper();
if (class_exists('SnipeItHelper')) {
$snipe_api = new SnipeItHelper();
}
$actor = $this->getActor(); $actor = $this->getActor();
$actor_phid = $actor->getPHID(); $actor_phid = $actor->getPHID();
......
...@@ -939,8 +939,9 @@ final class PhabricatorPolicyFilter extends Phobject { ...@@ -939,8 +939,9 @@ final class PhabricatorPolicyFilter extends Phobject {
} }
// See long comment in PhabricatorCursorPagedPolicyAwareQuery // See long comment in PhabricatorCursorPagedPolicyAwareQuery
if ($space->getPHID() == PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace()->getPHID()) { if(PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace() &&
return true; $space->getPHID() == PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace()->getPHID()) {
return true;
} }
// This may be more involved later, but for now being able to see the // This may be more involved later, but for now being able to see the
......
...@@ -102,7 +102,10 @@ final class PhabricatorSpacesNamespaceQuery ...@@ -102,7 +102,10 @@ final class PhabricatorSpacesNamespaceQuery
// exist. // exist.
$spaces = self::getViewerSpaces($viewer); $spaces = self::getViewerSpaces($viewer);
unset($spaces[self::getMagicAllUsersSpace()->getPHID()]); if (self::getMagicAllUsersSpace()) {
unset($spaces[self::getMagicAllUsersSpace()->getPHID()]);
}
return (count($spaces) > 1); return (count($spaces) > 1);
} }
......
...@@ -3120,10 +3120,11 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery ...@@ -3120,10 +3120,11 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
// //
// Modifying this code is not recommended. // Modifying this code is not recommended.
$result_object_interface = $this->newResultObject(); $result_object_interface = $this->newResultObject();
if ($result_object_interface instanceof PhrictionContent || if (PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace() &&
$result_object_interface instanceof PhrictionDocument) { ($result_object_interface instanceof PhrictionContent ||
$result_object_interface instanceof PhrictionDocument)) {
$all_user_space = PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace(); $all_user_space = PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace();
$space_phids[$all_user_space->getPHID()] = $all_user_space->getPHID(); $space_phids[$all_user_space->getPHID()] = $all_user_space->getPHID();
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment