Comment for #26196.

Fixes #26196.

Alternatively we could explicitly check and complain (eg. panic), but I don't see the value-add.
This commit is contained in:
Joshua Landau 2015-06-11 14:23:51 +01:00
parent 7e9a8e322a
commit b107af3ada

View file

@ -311,6 +311,7 @@ impl ExactSizeIterator for Args {
impl Drop for Args {
fn drop(&mut self) {
// NULL-safe
unsafe { c::LocalFree(self.cur as *mut c_void); }
}
}
@ -321,6 +322,8 @@ pub fn args() -> Args {
let lpCmdLine = c::GetCommandLineW();
let szArgList = c::CommandLineToArgvW(lpCmdLine, &mut nArgs);
// cur may be NULL if CommandLineToArgvW failed,
// in which case the range is empty to prevent reads
Args { cur: szArgList, range: 0..(nArgs as isize) }
}
}