@@ -114,7 +114,11 @@ await IOUtil.UnzipFiles(path, tempFolder, (file) =>
114
114
{
115
115
if ( Path . GetFileName ( file ) . StartsWith ( "group_" ) && Path . GetFileName ( file ) . ToLower ( ) . EndsWith ( ".json" ) )
116
116
{
117
- groups . Add ( JsonConvert . DeserializeObject < PMPGroupJson > ( File . ReadAllText ( file ) ) ) ;
117
+ var group = JsonConvert . DeserializeObject < PMPGroupJson > ( File . ReadAllText ( file ) ) ;
118
+ if ( group != null )
119
+ {
120
+ groups . Add ( group ) ;
121
+ }
118
122
}
119
123
}
120
124
@@ -137,9 +141,10 @@ await IOUtil.UnzipFiles(path, tempFolder, (file) =>
137
141
foreach ( var o in g . Options )
138
142
{
139
143
var op = o as PmpStandardOptionJson ;
140
- if ( op != null )
144
+ if ( op != null )
141
145
{
142
- foreach ( var kv in op . Files )
146
+ ValidateOption ( op ) ;
147
+ foreach ( var kv in op . Files )
143
148
{
144
149
var zipPath = kv . Value ;
145
150
allPmpFiles . Add ( zipPath ) ;
@@ -151,6 +156,7 @@ await IOUtil.UnzipFiles(path, tempFolder, (file) =>
151
156
var defOp = pmp . DefaultMod as PmpStandardOptionJson ;
152
157
if ( defOp != null )
153
158
{
159
+ ValidateOption ( defOp ) ;
154
160
foreach ( var kv in defOp . Files )
155
161
{
156
162
var zipPath = kv . Value ;
@@ -190,6 +196,26 @@ private static bool IsPmpJsonFile(string file)
190
196
return false ;
191
197
}
192
198
199
+ /// <summary>
200
+ /// Preforms basic cleanup-validation on options.
201
+ /// </summary>
202
+ /// <param name="op"></param>
203
+ private static void ValidateOption ( PmpStandardOptionJson op )
204
+ {
205
+ if ( op . Files == null )
206
+ {
207
+ op . Files = new Dictionary < string , string > ( ) ;
208
+ }
209
+ if ( op . Manipulations == null )
210
+ {
211
+ op . Manipulations = new List < PMPManipulationWrapperJson > ( ) ;
212
+ }
213
+ if ( op . FileSwaps == null )
214
+ {
215
+ op . FileSwaps = new Dictionary < string , string > ( ) ;
216
+ }
217
+ }
218
+
193
219
/// <summary>
194
220
/// Imports a given PMP File, Penumbra Folder, or Penumbra Folder Root JSON into the game files.
195
221
/// </summary>
@@ -712,6 +738,7 @@ public static async Task CreateSimplePmp(string destination, BaseModpackData mod
712
738
pmp . Meta . FileVersion = 3 ;
713
739
pmp . Meta . Version = modpackMeta . Version . ToString ( ) ;
714
740
pmp . Meta . Website = modpackMeta . Url ;
741
+ pmp . Meta . ModTags = pmp . Meta . ModTags ?? new List < string > ( ) ;
715
742
716
743
717
744
await WritePmp ( pmp , workingPath , zip ? destination : null ) ;
@@ -734,6 +761,11 @@ public static async Task WritePmp(PMPJson pmp, string workingDirectory, string z
734
761
var metapath = Path . Combine ( workingDirectory , "meta.json" ) ;
735
762
var defaultModPath = Path . Combine ( workingDirectory , "default_mod.json" ) ;
736
763
764
+ if ( pmp . Meta . ModTags == null )
765
+ {
766
+ pmp . Meta . ModTags = new List < string > ( ) ;
767
+ }
768
+
737
769
var metaString = JsonConvert . SerializeObject ( pmp . Meta , Formatting . Indented ) ;
738
770
File . WriteAllText ( metapath , metaString ) ;
739
771
0 commit comments