Fix crash on generating menu with both tags <DefaultAppDirs/> and <KDELegacyDirs/> present.