Skip to content

Commit

Permalink
fix: panic when fetch empty directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ho-229 committed May 5, 2024
1 parent 9d804f3 commit bf11967
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/sftp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ impl SyncFilter for Filter {
.unlink(path)
.map_err(|_| CloudErrorKind::InvalidRequest)?,
}
ticket.pass().unwrap();
Ok(())
}();

Expand Down Expand Up @@ -297,6 +298,7 @@ impl SyncFilter for Filter {
}))
.map_err(|_| CloudErrorKind::InvalidRequest)?,
}
ticket.pass().unwrap();
Ok(())
}();

Expand Down
6 changes: 5 additions & 1 deletion src/command/commands.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{ops::Range, ptr, slice};
use std::{iter, ops::Range, ptr, slice};

use windows::{
core,
Expand Down Expand Up @@ -165,6 +165,10 @@ impl Command for CreatePlaceholders<'_> {
unsafe fn result(info: CF_OPERATION_PARAMETERS_0) -> Self::Result {
// iterate over the placeholders and return, in a new vector, whether or
// not they were created with their new USN
if info.TransferPlaceholders.PlaceholderCount == 0 {
return vec![];
}

slice::from_raw_parts(
info.TransferPlaceholders.PlaceholderArray,
info.TransferPlaceholders.PlaceholderCount as usize,
Expand Down

0 comments on commit bf11967

Please sign in to comment.