tomboy r2348 - in trunk: . Tomboy



Author: sharm
Date: Mon Feb 16 22:04:33 2009
New Revision: 2348
URL: http://svn.gnome.org/viewvc/tomboy?rev=2348&view=rev

Log:
* Tomboy/Watchers.cs: Add checks in NoteLinkWatcher.DoHighlight to
  prevent erroneous links. Fixes bug #323845, patch courtesy of
  Florian.

Modified:
   trunk/ChangeLog
   trunk/Tomboy/Watchers.cs

Modified: trunk/Tomboy/Watchers.cs
==============================================================================
--- trunk/Tomboy/Watchers.cs	(original)
+++ trunk/Tomboy/Watchers.cs	Mon Feb 16 22:04:33 2009
@@ -717,7 +717,25 @@
 
 		void DoHighlight (TrieHit hit, Gtk.TextIter start, Gtk.TextIter end)
 		{
+			// Some of these checks should be replaced with fixes to
+			// TitleTrie.FindMatches, probably.
+			if (hit.Value == null) {
+				Logger.Debug ("DoHighlight: null pointer error for '{0}'." , hit.Key);
+				return;
+			}
+			
+			if (Manager.Find(hit.Key) == null) {
+				Logger.Debug ("DoHighlight: '{0}' links to non-existing note." , hit.Key);
+				return;
+			}
+			
 			Note hit_note = (Note) hit.Value;
+
+			if (String.Compare (hit.Key.ToString(), hit_note.Title.ToString(), true ) != 0) { // == 0 if same string  
+				Logger.Debug ("DoHighlight: '{0}' links wrongly to note '{1}'." , hit.Key, hit_note.Title);
+				return;
+			}
+			
 			if (hit_note == this.Note)
 				return;
 



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