Fix router error

It's possible for the route to be null (no match) which leads to an
error like:

```
appwrite  | [Error] Timestamp: 2023-08-30T21:39:58+00:00
appwrite  | [Error] Type: Error
appwrite  | [Error] Message: Call to a member function label() on null
appwrite  | [Error] File: /usr/src/code/app/controllers/general.php
appwrite  | [Error] Line: 50
```

This adds a null check to prevent the error.
This commit is contained in:
Steven Nguyen 2023-08-30 15:02:15 -07:00
parent 589e4f5c7d
commit 24efa0de82
No known key found for this signature in database

View file

@ -47,7 +47,7 @@ Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE);
function router(App $utopia, Database $dbForConsole, SwooleRequest $swooleRequest, Request $request, Response $response)
{
$utopia->getRoute()->label('error', __DIR__ . '/../views/general/error.phtml');
$utopia->getRoute()?->label('error', __DIR__ . '/../views/general/error.phtml');
$host = $request->getHostname() ?? '';