Am Sonntag, 2. Oktober 2005 23:58 schrieb Angus Leeming:

> I can confirm the crash but can also supply some debug info.

Thanks. The reason for the crash is the same as # 2060: MathNestInsets may 
have 0 cells.

Fix attached. OK to commit? And the fix for # 2060?



Georg

PS: Daniel, many thanks for the bug reports. They are really useful.
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/mathed/ChangeLog lyx-1.4-cvs/src/mathed/ChangeLog
--- lyx-1.4-clean/src/mathed/ChangeLog	2005-10-03 13:39:19.000000000 +0200
+++ lyx-1.4-cvs/src/mathed/ChangeLog	2005-10-03 13:56:38.197723448 +0200
@@ -1,3 +1,8 @@
+2005-10-03  Georg Baum  <[EMAIL PROTECTED]>
+
+	* math_nestinset.C (doDispatch): fix crash when inserting math macros
+	with 0 arguments
+
 2005-10-02  Georg Baum  <[EMAIL PROTECTED]>
 
 	* math_kerninset.C (write): write width, not 0 (fixes bug 2050)
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/mathed/math_nestinset.C lyx-1.4-cvs/src/mathed/math_nestinset.C
--- lyx-1.4-clean/src/mathed/math_nestinset.C	2005-10-03 13:12:07.000000000 +0200
+++ lyx-1.4-cvs/src/mathed/math_nestinset.C	2005-10-03 13:55:49.664101680 +0200
@@ -861,7 +872,10 @@ void MathNestInset::doDispatch(LCursor &
 		int cell(0);
 		if (cmd.argument == "\\root")
 			cell = 1;
-		if (ar.size() == 1 && (ar[0].nucleus()->asNestInset())) {
+		// math macros are nest insets and may have 0 cells.
+		// handleNest would crash in this case.
+		if (ar.size() == 1 && (ar[0].nucleus()->asNestInset()) &&
+		    ar[0].nucleus()->nargs() > cell) {
 			cur.handleNest(ar[0], cell);
 		} else
 			cur.niceInsert(cmd.argument);

Reply via email to