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
array $xactions) {
$this->setContinueOnNoEffect(true);
if (class_exists('SnipeItHelper')) {
$snipe_api = new SnipeItHelper();
}
$actor = $this->getActor();
$actor_phid = $actor->getPHID();
......
......@@ -939,7 +939,8 @@ final class PhabricatorPolicyFilter extends Phobject {
}
// See long comment in PhabricatorCursorPagedPolicyAwareQuery
if ($space->getPHID() == PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace()->getPHID()) {
if(PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace() &&
$space->getPHID() == PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace()->getPHID()) {
return true;
}
......
......@@ -102,7 +102,10 @@ final class PhabricatorSpacesNamespaceQuery
// exist.
$spaces = self::getViewerSpaces($viewer);
if (self::getMagicAllUsersSpace()) {
unset($spaces[self::getMagicAllUsersSpace()->getPHID()]);
}
return (count($spaces) > 1);
}
......
......@@ -3120,8 +3120,9 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
//
// Modifying this code is not recommended.
$result_object_interface = $this->newResultObject();
if ($result_object_interface instanceof PhrictionContent ||
$result_object_interface instanceof PhrictionDocument) {
if (PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace() &&
($result_object_interface instanceof PhrictionContent ||
$result_object_interface instanceof PhrictionDocument)) {
$all_user_space = PhabricatorSpacesNamespaceQuery::getMagicAllUsersSpace();
$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