For the root group, the parent is `nullptr` so calling `parent_group()` would fail. This fixes the issue by adding a null check and returning `nullptr` otherwise.
For the root group, the parent is `nullptr` so calling `parent_group()` would fail. This fixes the issue by adding a null check and returning `nullptr` otherwise.