Fix segfault removing theme assets

Change-Id: I4827eb6e2b186547f1df6f9bbd048fb1e3a29890
(cherry picked from commit 7997350e51e294f577d5146e27d6776b0d6c1198)