Am Sonntag, 8. Januar 2006 12:25 schrieb Juergen Spitzmueller:
> Georg Baum wrote:
> > What do you propose? After all we don't know what is wrong, only that
> > there was no Format tag and some error occured.
> 
> Some thing like: "Could not read the layout file X. Please check if it 
is 
> corrupted."

This is better indeed. New patch (this time working) attached.

Georg
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2352
diff -u -p -r1.2352 ChangeLog
--- src/ChangeLog	4 Jan 2006 14:24:39 -0000	1.2352
+++ src/ChangeLog	8 Jan 2006 11:17:22 -0000
@@ -1,3 +1,7 @@
+2006-01-08  Georg Baum  <[EMAIL PROTECTED]>
+
+	* lyxtextclass.C (Read): Avoid endless loops for corrupted files
+
 2006-01-04  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* text2.C (deleteEmptyParagraphMechanism): since we delete a
Index: src/lyxtextclass.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtextclass.C,v
retrieving revision 1.52
diff -u -p -r1.52 lyxtextclass.C
--- src/lyxtextclass.C	2 Nov 2005 20:11:35 -0000	1.52
+++ src/lyxtextclass.C	8 Jan 2006 12:30:28 -0000
@@ -430,6 +430,13 @@ bool LyXTextClass::Read(string const & f
 	}
 
 	if (format != FORMAT) {
+		// Avoid endless loops for corrupted files
+		if (error || !lexrc.isOK()) {
+			lexrc.printError("Could not read the layout file " +
+			                 filename +
+			                 ". Please check if it is corrupted.");
+			return true;
+		}
 		lyxerr[Debug::TCLASS] << "Converting layout file from format "
 		                      << format << " to " << FORMAT << endl;
 		string const tempfile = lyx::support::tempName();

Reply via email to