about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/gc.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs
index 066fa0b2e43..697c6fcdfb4 100644
--- a/src/libcore/gc.rs
+++ b/src/libcore/gc.rs
@@ -102,6 +102,12 @@ unsafe fn walk_gc_roots(mem: Memory, visitor: Visitor) {
                 match sp {
                   Some(sp_info) => {
                     for walk_safe_point(frame.fp, sp_info) |root, tydesc| {
+                        // Skip null pointers, which can occur when a
+                        // unique pointer has already been freed.
+                        if ptr::is_null(*root) {
+                            again;
+                        }
+
                         if ptr::is_null(tydesc) {
                             // Root is a generic box.
                             let refcount = **root;