Fix nil pointer panic in WakeOnHost when MAC not found

This commit is contained in:
Ioannis Dressos 2026-07-08 12:11:38 +03:00
parent b517ae0feb
commit f67544ae2a
No known key found for this signature in database
1 changed files with 3 additions and 0 deletions

View File

@ -124,6 +124,9 @@ func WakeOnHost(db store.IStore) echo.HandlerFunc {
return func(c echo.Context) error {
macAddress := c.Param("mac_address")
host, err := db.GetWakeOnLanHost(macAddress)
if err != nil {
return createError(c, err, fmt.Sprintf("Wake On Host Not Found: %s", macAddress))
}
now := time.Now().UTC()
host.LatestUsed = &now