chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8e05679
)
api: setz: Avoid an unwrap
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Wed, 27 Apr 2022 22:13:33 +0000
(23:13 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 10:08:00 +0000
(11:08 +0100)
Panicking is worse than failing. Spotted this in passing.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
patch
|
blob
|
history
diff --git
a/daemon/api.rs
b/daemon/api.rs
index dd7756a9c34298068a8a7de08b0c9dd326f41a0a..4a59b5b68fd4ce1e44a903c2ed21323f47e759f3 100644
(file)
--- 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) }
}