More useful return error rather than a panic

This commit is contained in:
Neil Alexander 2022-04-28 12:47:29 +01:00
parent 3d757f9f6a
commit 2bb79640f7
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -41,10 +41,10 @@ func (r *Admin) PerformAdminEvacuateRoom(
}
return
}
if roomInfo.IsStub {
if roomInfo == nil || roomInfo.IsStub {
res.Error = &api.PerformError{
Code: api.PerformErrorBadRequest,
Msg: "room is stub",
Code: api.PerformErrorNoRoom,
Msg: fmt.Sprintf("Room %s not found", req.RoomID),
}
return
}