Handle null correctly with inline event handlers