Fix NPE with null groups