chiark / gitweb /
multigrab: Check that the piece is not held
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 10:43:45 +0000 (11:43 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Apr 2022 11:42:41 +0000 (12:42 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs

index b9d5636a33d7d459ee4889cb897c73c3ee18f11a..be3ef8a601ced13e42b5e8a53fd1ed01b4fd4815 100644 (file)
@@ -574,6 +574,8 @@ api_route!{
       if ! a.ipc.special.multigrab { throw!(Ia::BadPieceStateForOperation) }
       let pri = a.pri()?;
       let y = pri.fully_visible().ok_or(Ia::Occultation)?;
+      let gpc = a.gs.pieces.byid_mut(a.piece)?;
+      if gpc.held != None { throw!(Ia::PieceHeld) }
       a.ipc.show(y).op_multigrab(a, pri, self.n)?
     }
   }