Skip to content

Commit 24077fe

Browse files
committed
Fix unwrap
1 parent df3e1c9 commit 24077fe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/dbgp/client.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,12 @@ impl DbgpClient {
308308
debug!("[dbgp] >> {}", cmd_str);
309309
let bytes = [cmd_str.trim_end(), "\0"].concat();
310310
self.tid += 1;
311-
self.stream
312-
.as_mut()
313-
.unwrap()
314-
.write(bytes.as_bytes())
315-
.await
316-
.map_err(anyhow::Error::from)
311+
match self.stream.as_mut() {
312+
Some(stream) => stream.write(bytes.as_bytes())
313+
.await
314+
.map_err(anyhow::Error::from),
315+
None => Err(anyhow::anyhow!("Stream was closed")),
316+
}
317317
}
318318

319319
pub(crate) async fn disonnect(&mut self) -> Result<(), anyhow::Error> {

0 commit comments

Comments
 (0)