[blam] ChannelCollection: fix NRE that could happen when logging an exception
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] ChannelCollection: fix NRE that could happen when logging an exception
- Date: Sun, 16 Jun 2013 09:16:31 +0000 (UTC)
commit 43af92499d7b87aae4dc661f39153ec60daea7c6
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Sun Jun 16 11:17:03 2013 +0200
ChannelCollection: fix NRE that could happen when logging an exception
The Console.WriteLine was deferrencing e.InnerException without checking
if it was null first. Instead of doing this, we can just use "e.ToString()"
which will print inner exceptions by default if they exist. The crash was:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Imendio.Blam.ChannelCollection.LoadFromFile (System.String file) [0x00026] in
/home/knocte/Code/blam/src/ChannelCollection.cs:96
at Imendio.Blam.Application..ctor (System.String[] args) [0x000bc] in
/home/knocte/Code/blam/src/Application.cs:158
at Imendio.Blam.Application.Main (System.String[] args) [0x0001a] in
/home/knocte/Code/blam/src/Application.cs:895
src/ChannelCollection.cs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/ChannelCollection.cs b/src/ChannelCollection.cs
index d0ec17b..0d0eb28 100644
--- a/src/ChannelCollection.cs
+++ b/src/ChannelCollection.cs
@@ -93,7 +93,7 @@ namespace Imendio.Blam {
Console.WriteLine("trying to load from file");
collection = RealLoadFromFile (file);
} catch (Exception e) {
- Console.WriteLine("failed: {0}", e.InnerException.Message);
+ Console.WriteLine("failed: {0}", e);
try {
collection = RealLoadFromFile (Defines.APP_DATADIR + "/collection.xml");
} catch {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]