In the case of TypedefDecls we set the DeclContext after we imported it.
It turns out, it could lead to null pointer dereferences during the cleanup part of a failed import.
This patch demonstrates this issue and fixes it by checking if the DeclContext is available or not.