Skip to content

Commit

Permalink
Fix crash when editing freshly created mod
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Aug 20, 2024
1 parent 2dc9fe6 commit f472205
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mods/Alpakit/Source/Alpakit/Private/ModMetadataObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ void FModDependencyDescriptorData::CopyIntoDescriptor(FPluginReferenceDescriptor

if (!bBasePlugin) {
OutDescriptor.AdditionalFieldsToWrite.Add(TEXT("SemVersion"), MakeShared<FJsonValueString>( SemVersion ));
} else if (OutDescriptor.CachedJson->HasField(TEXT("SemVersion"))) {
} else if (OutDescriptor.CachedJson.IsValid() && OutDescriptor.CachedJson->HasField(TEXT("SemVersion"))) {
// We cannot remove the field when using UpdateDescriptor, because it will be copied from the existing descriptor
OutDescriptor.AdditionalFieldsToWrite.Add(TEXT("SemVersion"), MakeShared<FJsonValueString>( TEXT("") ));
}

if (bBasePlugin) {
OutDescriptor.AdditionalFieldsToWrite.Add(TEXT("BasePlugin"), MakeShared<FJsonValueBoolean>( bBasePlugin ));
} else if (OutDescriptor.CachedJson->HasField(TEXT("BasePlugin"))) {
} else if (OutDescriptor.CachedJson.IsValid() && OutDescriptor.CachedJson->HasField(TEXT("BasePlugin"))) {
// We cannot remove the field when using UpdateDescriptor, because it will be copied from the existing descriptor
OutDescriptor.AdditionalFieldsToWrite.Add(TEXT("BasePlugin"), MakeShared<FJsonValueBoolean>( false ));
}
Expand Down

0 comments on commit f472205

Please sign in to comment.