empty text can generate exception with text special

Bug #339327 reported by Peter Golde on 2009-03-07
Affects Status Importance Assigned to Milestone
Purple Pen
Peter Golde

Bug Description

Using PurplePen v1.0.0rc1 I can repeatedly get an unhandled exception if you say try to Add a Special Item->Text->Climb on a course where no climb has been entered. If you drag a bounding box for the text then things work. The error occurs if you just single-click to put the default size text box in. You then get a error message saying that a value of 0 for variable emSize is not valid.

I would guess that the problem will affect any special text - no matter what type - when the text is empty and you single click to place the text.

The exception detail is as follows if it helps.


************** Exception Text **************
System.ArgumentException: Value of '0' is not valid for 'emSize'. 'emSize' should be greater than 0 and less than or equal to System.Single.MaxValue.
Parameter name: emSize
   at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
   at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style, GraphicsUnit unit)
   at PurplePen.MapModel.TextSymDef.CreateObjects()
   at PurplePen.MapModel.TextSymDef.BreakUnwrappedLines(String[] text, Single[]& lineWidths)
   at PurplePen.MapModel.TextSymbol..ctor(TextSymDef def, String[] text, PointF location, Single angle, Single width)
   at PurplePen.TextCourseObj.AddToMap(Map map, SymDef symdef)
   at PurplePen.CourseObj.AddToMap(Map map, SymColor symColor, Dictionary`2 dict)
   at PurplePen.CourseLayout.RenderToMap()
   at PurplePen.MapDisplay.SetCourse(CourseLayout newCourse)
   at PurplePen.MainFrame.Application_Idle(Object sender, EventArgs e)

Changed in purple-pen:
assignee: nobody → peter-golde
importance: Undecided → High
Changed in purple-pen:
status: New → Fix Committed
Changed in purple-pen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers