Closed hcs64 closed 5 years ago
Nice catch, thanks! BStr
is not used anywhere else in winrt-rust, so this change has not a big impact, but it might be a good idea to do the same thing in hstring.rs
(internal_to_string
), because WindowsGetStringRawBuffer
can also return NULL
(I just checked).
What I said above about WindowsGetStringRawBuffer
was rubbish. It can't return NULL
. But this PR is totally correct :)
According to the docs for
std::slice::from_raw_parts
, "data
must be non-null and aligned, even for zero-length slices". Doesn't cause any issues currently, but it's worthwhile to be pedantic about nulls.