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/
[EMAIL PROTECTED] [EMAIL PROTECTED]
Index: ut_units.cpp
===================================================================
RCS file: /u2/cvsroot/abi/src/af/util/xp/ut_units.cpp,v
retrieving revision 1.28
diff -u -r1.28 ut_units.cpp
--- ut_units.cpp 2000/08/09 01:38:11 1.28
+++ ut_units.cpp 2000/08/22 12:49:17
@@ -272,6 +272,10 @@
return 0;
double f = UT_convertDimensionless(s);
+
+ if (f == 0)
+ return 0;
+
const char *p = s;
while ((*p) && (isdigit(*p) || (*p == '-') || (*p == '.')))
{