Fix crash when opening entity form from layer without attribute

When right-clicking in the attribute table of a layer that has
no attribute, no feature is selected. If selecting the 'Edit form'
entry, we got a crash.