Fix bug #21967: fix crash when unit modification to traits has empty id