Fixes a crash when handling local notifications

Fixes #459.