diff options
author | Karl <contact@scowencomputers.co.nz> | 2020-01-18 06:51:32 +0300 |
---|---|---|
committer | Karl <contact@scowencomputers.co.nz> | 2020-01-18 06:51:32 +0300 |
commit | f39d6526422c3ab4994daa067ff6fde98d774ae0 (patch) | |
tree | fe2d4dfa22d926f0e3403c93bc15dfc729193b8a /mcs | |
parent | ff494e6065c41d8ab0eb6baf6566389bb9e6d607 (diff) |
Fix NullReferenceException when parsing RTF.
charset_stack was never initialised.
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs index f7027337c70..547048d3300 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs @@ -98,6 +98,7 @@ namespace System.Windows.Forms.RTF { line_pos = 0; prev_char = unchecked((char)-1); bump_line = false; + charset_stack = new Stack(); destination_callbacks = new DestinationCallback(); class_callbacks = new ClassCallback(); @@ -402,7 +403,7 @@ SkipCRLF: case Major.EndGroup: { if (charset_stack.Count > 0) { encoding = (Encoding)this.charset_stack.Pop(); - encoding_code_page = encoding.CodePage; + encoding_code_page = encoding?.CodePage ?? DefaultEncodingCodePage; } else { encoding = null; encoding_code_page = DefaultEncodingCodePage; |