Fix Preset List with no customs available (#5535)
* Surround preset file processing with the fs::exists check rather than returning early. * clang
This commit is contained in:
@@ -193,12 +193,10 @@ void ParsePreset(nlohmann::json& json, std::string name) {
|
||||
}
|
||||
|
||||
void LoadPresets() {
|
||||
if (!fs::exists(presetFolder)) {
|
||||
return;
|
||||
}
|
||||
if (!presets.empty()) {
|
||||
presets.clear();
|
||||
}
|
||||
if (fs::exists(presetFolder)) {
|
||||
for (auto const& preset : fs::directory_iterator(presetFolder)) {
|
||||
std::ifstream ifs(preset.path());
|
||||
|
||||
@@ -211,6 +209,7 @@ void LoadPresets() {
|
||||
}
|
||||
ifs.close();
|
||||
}
|
||||
}
|
||||
auto initData = std::make_shared<Ship::ResourceInitData>();
|
||||
initData->Format = RESOURCE_FORMAT_BINARY;
|
||||
initData->Type = static_cast<uint32_t>(Ship::ResourceType::Json);
|
||||
|
||||
Reference in New Issue
Block a user