Fix for crash in zero quantities


Subject: Fix for crash in zero quantities
From: Tim Allen (rita_tim@tpg.com.au)
Date: Tue Aug 22 2000 - 08:12:03 CDT


I was getting a crash due to an assert in ::convertToInches() in
ut_units.cpp, while opening a document I had saved the day before. The
thing that upset the code was that the left margin was specified as "0",
with no unit. The right margin, btw, was 8cm; maybe this is a cm-specific
problem. The assert amounts to asserting that there must be a recognisable
unit. In this case, the quantity is zero, so we don't care what unit it
is. This patch checks for that case, and returns before the unit test in
that case, so we never trip over the assert.

I wonder whether this actually indicates a problem in the document saving
code, but imho writing a zero with no unit is perfectly reasonable
behaviour, so we ought to cope with it.

Tim

-- 
-----------------------------------------------------------
Tim Allen             http://www4.tpg.com.au/users/rita_tim/
tim@proximity.com.au  rita_tim@tpg.com.au




This archive was generated by hypermail 2b25 : Tue Aug 22 2000 - 08:00:51 CDT