bugfix: Fixed theoretically-possible null pointer exception.

Don't know the preference lifecycle well enough myself, but it is
possible.