mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Fix exception accessing a non-existing EditEngine
Summary: Trying to access a non-existing edit engine "foo" via the URI `/transactions/editengine/foo/` throws an unhandled exception. `PhabricatorEditEngine::getByKey($viewer, $engine_key)` is null as `$engine_key` is non-existing `foo`. Thus avoid calling `setViewer()` on `null` by splitting into a separate step after a null check. When null, show a proper 404 error instead. ``` EXCEPTION: (Error) Call to a member function setViewer() on null at [<phorge>/src/applications/transactions/controller/PhabricatorEditEngineConfigurationListController.php:17] ``` Closes T15793 Test Plan: While logged in and with sufficient permissions, * go to non-existing http://phorge.localhost/transactions/editengine/whatever/ before and after applying patch, * go to existing http://phorge.localhost/transactions/editengine/maniphest.task/ to see that existing stuff still works. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15793 Differential Revision: https://we.phorge.it/D25597
This commit is contained in:
parent
93c7444d5c
commit
4da88848be
1 changed files with 3 additions and 4 deletions
|
@ -13,12 +13,11 @@ final class PhabricatorEditEngineConfigurationListController
|
|||
$engine_key = $request->getURIData('engineKey');
|
||||
$this->setEngineKey($engine_key);
|
||||
|
||||
$engine = PhabricatorEditEngine::getByKey($viewer, $engine_key)
|
||||
->setViewer($viewer);
|
||||
|
||||
if (!$engine->isEngineConfigurable()) {
|
||||
$engine = PhabricatorEditEngine::getByKey($viewer, $engine_key);
|
||||
if (!$engine || !$engine->isEngineConfigurable()) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
$engine->setViewer($viewer);
|
||||
|
||||
$items = array();
|
||||
$items[] = id(new PHUIListItemView())
|
||||
|
|
Loading…
Reference in a new issue