From d623c46058644e2561e2806a165591b4eb37677d Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 27 Apr 2022 23:13:33 +0100 Subject: [PATCH] api: setz: Avoid an unwrap Panicking is worse than failing. Spotted this in passing. Signed-off-by: Ian Jackson --- daemon/api.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/api.rs b/daemon/api.rs index dd7756a9..4a59b5b6 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -456,7 +456,7 @@ api_route!{ #[throws(ApiPieceOpError)] fn op(&self, a: ApiPieceOpArgs) -> PieceUpdate { let ApiPieceOpArgs { gs,piece, .. } = a; - let gpc = gs.pieces.byid_mut(piece).unwrap(); + let gpc = gs.pieces.byid_mut(piece)?; if gpc.occult.is_active() { if self.z >= gpc.zlevel.z { throw!(Ia::Occultation) } } -- 2.30.2