Region Editor: Fix NPE and cleanup code