Added warning if asWidget is called while being null

And I agree with @rdwallis an assert would be better