Fix crash when adding group to empty palette.
This model needs to be fully rewritten to be tree-based, because it is just too fragile right now.
BUG:388841