extractor: Prevent NULL dereference when extracting to root
This is followup of the commit 72372764. The extraction to root can still
lead to crashes because the parent
variable is NULL
and is consequently
passed into the g_object_unref
function. Let's finally fix this corner
case properly.