[longomatch] Fix possible access to null File objects



commit 6b4b061848df2ba0a9c7c3f916a9c839822a1bba
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Nov 25 01:33:24 2012 +0100

    Fix possible access to null File objects

 LongoMatch.Core/Store/ProjectDescription.cs |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Store/ProjectDescription.cs b/LongoMatch.Core/Store/ProjectDescription.cs
index 4f61d61..1e0a430 100644
--- a/LongoMatch.Core/Store/ProjectDescription.cs
+++ b/LongoMatch.Core/Store/ProjectDescription.cs
@@ -41,6 +41,8 @@ namespace LongoMatch.Store
 		/// </summary>
 		public String Title {
 			get {
+				if (File == null)
+					return "";
 				return System.IO.Path.GetFileNameWithoutExtension(File.FilePath);
 			}
 		}
@@ -115,6 +117,8 @@ namespace LongoMatch.Store
 		/// </summary>
 		public String Format {
 			get {
+				if (File == null)
+					return "";
 				return String.Format("{0}x{1} {2}fps",
 				                     File.VideoWidth, File.VideoHeight, File.Fps);
 			}
@@ -128,7 +132,9 @@ namespace LongoMatch.Store
 		public int CompareTo(object obj) {
 			if(obj is ProjectDescription) {
 				ProjectDescription project = (ProjectDescription) obj;
-
+				
+				if (File == null || project.File == null)
+					return UUID.CompareTo(project.UUID);
 				return this.File.FilePath.CompareTo(project.File.FilePath);
 			}
 			else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]