fix crash when accesing null objects
Merge pull request #44 from lpotter/fixbearercrash

fix crash when accesing null objects