CPack/DragNDrop: Avoid crash when locale identifier creation fails

If `CFLocaleCreateCanonicalLanguageIdentifierFromString` fails, stop
gracefully.  Otherwise we crash because `CFStringGetCString` cannot work
with null `CFStrings`.
This commit is contained in:
AZero13
2025-05-26 15:15:02 -04:00
committed by Brad King
parent cfcff29087
commit bbc98fb67a

View File

@@ -601,6 +601,7 @@ int cmCPackDragNDropGenerator::CreateDMG(std::string const& src_dir,
cmCPackLogger(cmCPackLog::LOG_ERROR,
language << " is not a recognized language"
<< std::endl);
return 0;
}
char iso_language_cstr[65];
CFStringGetCString(iso_language, iso_language_cstr,