Avoid creating slices with null pointers.

This commit is contained in:
Dan Gohman
2019-01-03 12:04:19 -08:00
parent 57e183f5f8
commit 701b1998e9
4 changed files with 8 additions and 5 deletions

View File

@@ -70,7 +70,7 @@ impl CodeMemory {
self.position = 0;
for m in &mut self.mmaps[self.published..] {
if !m.as_ptr().is_null() {
if m.len() != 0 {
unsafe {
region::protect(m.as_mut_ptr(), m.len(), region::Protection::ReadExecute)
}