[longomatch] Handle pixbuf errors in serialization
- From: Andoni Morales Alastruey <amorales src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [longomatch] Handle pixbuf errors in serialization
 
- Date: Thu, 22 Aug 2013 16:46:52 +0000 (UTC)
 
commit dea62ab785caa3d16b2b5c3e2b269b5abb7a3abe
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Aug 22 18:46:16 2013 +0200
    Handle pixbuf errors in serialization
 LongoMatch.Core/Common/Image.cs |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Image.cs b/LongoMatch.Core/Common/Image.cs
index c8da940..f4acb84 100644
--- a/LongoMatch.Core/Common/Image.cs
+++ b/LongoMatch.Core/Common/Image.cs
@@ -54,12 +54,20 @@ namespace LongoMatch.Common
                
                // this constructor is automatically called during deserialization
                public Image (SerializationInfo info, StreamingContext context) {
-                       image = Deserialize ((byte[]) info.GetValue ("pngbuf", typeof (byte[]))).Value;
+                       try {
+                               image = Deserialize ((byte[]) info.GetValue ("pngbuf", typeof 
(byte[]))).Value;
+                       } catch {
+                               image = null;
+                       }
                }
 
                // this method is automatically called during serialization
                public void GetObjectData(SerializationInfo info, StreamingContext context) {
-                       info.AddValue("pngbuf", Serialize());
+                       try {
+                               info.AddValue("pngbuf", Serialize());
+                       } catch  {
+                               info.AddValue("pngbuf", null);
+                       }
                }
                
                
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]