EditorApi: Check for sections

Don't try to access an undefined object.

Add tests for it.

Bug: 72521
Change-Id: I8b88bda22e2219cf65233fd6f0a6ee15444fac3d
Merge "EditorApi: Check for sections"