Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/class
diff options
context:
space:
mode:
authorKarl <contact@scowencomputers.co.nz>2020-01-18 06:51:32 +0300
committerKarl <contact@scowencomputers.co.nz>2020-01-18 06:51:32 +0300
commitf39d6526422c3ab4994daa067ff6fde98d774ae0 (patch)
treefe2d4dfa22d926f0e3403c93bc15dfc729193b8a /mcs/class
parentff494e6065c41d8ab0eb6baf6566389bb9e6d607 (diff)
Fix NullReferenceException when parsing RTF.
charset_stack was never initialised.
Diffstat (limited to 'mcs/class')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.RTF/RTF.cs3
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;