nickbabcock / Pdoxcl2Sharp

A Paradox Interactive general file parser
MIT License
39 stars 13 forks source link

Guard Against Null Consecutive Element Lists #20

Closed nickbabcock closed 10 years ago

nickbabcock commented 10 years ago

In the parsing template, a null reference will occur when writing a type of "[ConsecutiveElements]" that has not been read in. Thus there should be a null check before reading. An alternative solution would be to instantiate the list in the constructor, but this might not be the best idea as it would cause unnecessary garbage collection if parsed and if there weren't elements, the writer would always write an empty. This may surprise the user. If a list didn't appear in the text, why should it be written out, even if empty.