Handle nulls

This commit is contained in:
Lance Pioch 2024-06-18 10:59:50 -04:00
parent 958e8fac8a
commit d4484f5254
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,10 @@ class EndpointSynth extends Synth
public function hydrate($value) public function hydrate($value)
{ {
if (!is_string($value) && !is_int($value)) {
return null;
}
return new Endpoint($value); return new Endpoint($value);
} }
} }

View File

@ -447,6 +447,10 @@ class Server extends Model
$portEggVariable = $this->variables->firstWhere('env_variable', 'SERVER_PORT'); $portEggVariable = $this->variables->firstWhere('env_variable', 'SERVER_PORT');
if ($portEggVariable) { if ($portEggVariable) {
$portServerVariable = $this->serverVariables->firstWhere('variable_id', $portEggVariable->id); $portServerVariable = $this->serverVariables->firstWhere('variable_id', $portEggVariable->id);
if (! $portServerVariable) {
return null;
}
$endpoint = new Endpoint($portServerVariable->variable_value); $endpoint = new Endpoint($portServerVariable->variable_value);
} }