Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/dia/ChangeLog,v
retrieving revision 1.1824
diff -u -r1.1824 ChangeLog
--- ChangeLog	30 Dec 2005 18:12:56 -0000	1.1824
+++ ChangeLog	30 Dec 2005 21:58:12 -0000
@@ -1,5 +1,8 @@
 2005-12-30  Hans Breuer  <hans@breuer.org>
 
+	* objects/UML/class.c : Patch from Dave Klotzbach
+	fixes crash bug #325151
+
 	* app/app_procs.c : add command line parameter --nonew to allow
 	avoiding the empty start-up diagram
 	Also give a hint on where the object-libs were missing.
Index: objects/UML/class.c
===================================================================
RCS file: /cvs/gnome/dia/objects/UML/class.c,v
retrieving revision 1.86
diff -u -r1.86 class.c
--- objects/UML/class.c	9 Nov 2005 04:05:03 -0000	1.86
+++ objects/UML/class.c	30 Dec 2005 21:58:16 -0000
@@ -511,7 +511,13 @@
   gint   LengthOfComment       = strlen(comment);
   gint   CommentIndex          = 0;
   gint   LengthOfWrappedComment= 0;
-  gint   LineLen    = WrapPoint - TagLength;
+  /* Make sure that there is at least some value greater then zero for the WrapPoint to 
+   * support diagrams from earlier versions of Dia. So if the WrapPoint is zero then use
+   * the taglength as the WrapPoint. If the Tag has been changed such that it has a length
+   * of 0 then use 1.
+   */
+  gint   WorkingWrapPoint      = (WrapPoint <= TagLength )?((TagLength<=0)?1:TagLength):WrapPoint;
+  gint   LineLen    = WorkingWrapPoint - TagLength;
 
   WrappedComment[0] = '\0';
   strcat(WrappedComment, CommentTag);
@@ -557,7 +563,7 @@
         }
       }
       if ((*NumberOfLines > 1) &&( LineLen == 0)){
-          LineLen = WrapPoint;
+          LineLen = WorkingWrapPoint;
       }
     }
   if (LineLen < 0){
@@ -579,7 +585,7 @@
       *NumberOfLines+=1;
     }
     LengthOfWrappedComment = strlen(WrappedComment);
-    LineLen    = WrapPoint;
+    LineLen    = WorkingWrapPoint;
   }
   WrappedComment = g_realloc(WrappedComment,LengthOfWrappedComment+2);
   strcat(WrappedComment, "}");
