[smuxi/stable] Frontend-GNOME: fix NRE when not all encodings are available
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi/stable] Frontend-GNOME: fix NRE when not all encodings are available
- Date: Sun, 15 Nov 2015 13:26:52 +0000 (UTC)
commit 699f395263f65bd496a4ca88e2929c18d7521f9c
Author: Mirco Bauer <meebey meebey net>
Date: Sun Nov 15 13:11:46 2015 +0100
Frontend-GNOME: fix NRE when not all encodings are available
On openSUSE with Mono 4.0.4.1 and not having the mono-locale-extras package
installed leads to an NullReferenceException in PreferencesDialog._Load(). Thus
added de-reference guards.
.../Preferences/PreferencesDialog.cs | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
b/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
index 15a0406..6e7fed8 100644
--- a/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
+++ b/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
@@ -343,6 +343,9 @@ namespace Smuxi.Frontend.Gnome
foreach (EncodingInfo encInfo in Encoding.GetEncodings()) {
try {
Encoding enc = Encoding.GetEncoding(encInfo.CodePage);
+ if (enc == null || enc.EncodingName == null) {
+ continue;
+ }
string encodingName = enc.EncodingName.ToUpper();
if (!enc.IsSingleByte && enc != Encoding.UTF8) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]