Added warning if asWidget is called while being null

This seems like it would be cleaner as one line assert.