f-spot r4630 - in trunk: . src/Core



Author: sdelcroix
Date: Wed Nov 26 14:12:47 2008
New Revision: 4630
URL: http://svn.gnome.org/viewvc/f-spot?rev=4630&view=rev

Log:
check for null args on pulic methods

2008-11-26  Stephane Delcroix  <sdelcroix novell com>

	* src/Core/BrowsablePointer.cs:
	* src/Core/Category.cs:
	* src/Core/Delay.cs:
	* src/Core/PhotosChanges.cs:
	* src/Core/Tag.cs: Check for null arguments on public methods

Modified:
   trunk/ChangeLog
   trunk/src/Core/BrowsablePointer.cs
   trunk/src/Core/Category.cs
   trunk/src/Core/Delay.cs
   trunk/src/Core/PhotosChanges.cs
   trunk/src/Core/Tag.cs

Modified: trunk/src/Core/BrowsablePointer.cs
==============================================================================
--- trunk/src/Core/BrowsablePointer.cs	(original)
+++ trunk/src/Core/BrowsablePointer.cs	Wed Nov 26 14:12:47 2008
@@ -6,6 +6,7 @@
  *
  * This is free software. See COPYING for details.
  */
+using System;
 
 namespace FSpot
 {
@@ -18,6 +19,9 @@
 
 		public BrowsablePointer (IBrowsableCollection collection, int index)
 		{
+			if (collection == null)
+				throw new ArgumentNullException ("collection");
+
 			this.collection = collection;
 			this.Index = index;
 			item = Current;
@@ -127,6 +131,8 @@
 		
 		protected void HandleCollectionChanged (IBrowsableCollection collection)
 		{
+			if (collection == null)
+				throw new ArgumentNullException ("collection");
 			int old_location = Index;
 			int next_location = collection.IndexOf (item);
 			

Modified: trunk/src/Core/Category.cs
==============================================================================
--- trunk/src/Core/Category.cs	(original)
+++ trunk/src/Core/Category.cs	Wed Nov 26 14:12:47 2008
@@ -8,6 +8,7 @@
  * This is free software. See COPYING for details.
  */
 
+using System;
 using System.Collections.Generic;
 
 namespace FSpot
@@ -30,6 +31,9 @@
 		// Appends all of this categories descendents to the list
 		public void AddDescendentsTo (IList<Tag> list)
 		{
+			if (list == null)
+				throw new ArgumentNullException ("list");
+
 			foreach (Tag tag in children) {
 				if (! list.Contains (tag))
 					list.Add (tag);

Modified: trunk/src/Core/Delay.cs
==============================================================================
--- trunk/src/Core/Delay.cs	(original)
+++ trunk/src/Core/Delay.cs	Wed Nov 26 14:12:47 2008
@@ -65,6 +65,8 @@
 
 		public void Connect (Gtk.Object obj)
 		{
+			if (obj == null)
+				throw new ArgumentNullException ("obj");
 			obj.Destroyed += HandleDestroy; 
 		}	     
 		

Modified: trunk/src/Core/PhotosChanges.cs
==============================================================================
--- trunk/src/Core/PhotosChanges.cs	(original)
+++ trunk/src/Core/PhotosChanges.cs	Wed Nov 26 14:12:47 2008
@@ -122,6 +122,11 @@
 
 		public static PhotosChanges operator | (PhotosChanges c1, PhotosChanges c2)
 		{
+			if (c1 == null)
+				throw new ArgumentNullException ("c1");
+			if (c2 == null)
+				throw new ArgumentNullException ("c2");
+
 			PhotosChanges changes = new PhotosChanges ();
 			changes.changes = c1.changes | c2.changes;
 			changes.VersionsChanged = c1.VersionsChanged || c2.VersionsChanged;

Modified: trunk/src/Core/Tag.cs
==============================================================================
--- trunk/src/Core/Tag.cs	(original)
+++ trunk/src/Core/Tag.cs	Wed Nov 26 14:12:47 2008
@@ -130,6 +130,9 @@
 		// IComparer.
 		public int CompareTo (Tag tag)
 		{
+			if (tag == null)
+				throw new ArgumentNullException ("tag");
+
 			if (Category == tag.Category) {
 				if (SortPriority == tag.SortPriority)
 					return Name.CompareTo (tag.Name);
@@ -142,6 +145,9 @@
 		
 		public bool IsAncestorOf (Tag tag)
 		{
+			if (tag == null)
+				throw new ArgumentNullException ("tag");
+
 			for (Category parent = tag.Category; parent != null; parent = parent.Category) {
 				if (parent == this)
 					return true;



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