gingerBill 7 years ago
parent
commit
0134c38759
1 changed files with 4 additions and 3 deletions
  1. 4 3
      core/_preload.odin

+ 4 - 3
core/_preload.odin

@@ -1292,9 +1292,6 @@ __dynamic_map_erase :: proc(using h: __Map_Header, fr: __Map_Find_Result) {
 		__dynamic_map_get_entry(h, fr.entry_prev).next = __dynamic_map_get_entry(h, fr.entry_index).next;
 	}
 
-	if fr.entry_index == m.entries.len-1 {
-		m.entries.len -= 1;
-	}
 	__mem_copy(__dynamic_map_get_entry(h, fr.entry_index), __dynamic_map_get_entry(h, m.entries.len-1), entry_size);
 	last := __dynamic_map_find(h, __dynamic_map_get_entry(h, fr.entry_index).key);
 	if last.entry_prev >= 0 {
@@ -1302,4 +1299,8 @@ __dynamic_map_erase :: proc(using h: __Map_Header, fr: __Map_Find_Result) {
 	} else {
 		m.hashes[last.hash_index] = fr.entry_index;
 	}
+
+	if fr.entry_index == m.entries.len-1 {
+		m.entries.len -= 1;
+	}
 }