diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index e49c37be5ef8769d3fdaf00ccfc59706cad554a1..3435217fa48500a791d717e84b59d2c349c8f8d3 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2969,9 +2969,11 @@ void LLViewerObject::unlinkControlAvatar()
     if (isRootEdit())
     {
         // This will remove the entire linkset from the control avatar
-        LLControlAvatar *av = mControlAvatar;
-        mControlAvatar = NULL;
-        av->markForDeath();
+        if (mControlAvatar)
+        {
+            mControlAvatar->markForDeath();
+            mControlAvatar = NULL;
+        }
     }
     // For non-root prims, removing from the linkset will
     // automatically remove the control avatar connection.