Author: rgheck
Date: Fri May 27 21:47:10 2011
New Revision: 38858
URL: http://www.lyx.org/trac/changeset/38858

Log:
Some cleanup and a fix for a potential crash while investigating #7572.

Modified:
   lyx-devel/trunk/src/BufferView.cpp
   lyx-devel/trunk/src/frontends/qt4/GuiView.cpp

Modified: lyx-devel/trunk/src/BufferView.cpp
==============================================================================
--- lyx-devel/trunk/src/BufferView.cpp  Fri May 27 17:49:40 2011        (r38857)
+++ lyx-devel/trunk/src/BufferView.cpp  Fri May 27 21:47:10 2011        (r38858)
@@ -2188,8 +2188,8 @@
 
 void BufferView::setCursorFromRow(int row)
 {
-       int tmpid = -1;
-       int tmppos = -1;
+       int tmpid;
+       int tmppos;
 
        buffer_.texrow().getIdFromRow(row, tmpid, tmppos);
 

Modified: lyx-devel/trunk/src/frontends/qt4/GuiView.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Fri May 27 17:49:40 
2011        (r38857)
+++ lyx-devel/trunk/src/frontends/qt4/GuiView.cpp       Fri May 27 21:47:10 
2011        (r38858)
@@ -2930,6 +2930,13 @@
                        return false;
                }
        }
+       if (!buf) {
+               message(bformat(
+                       _("No buffer for file `%1$s'."),
+                       makeDisplayPath(file_name))
+               );
+               return false;
+       }
        setBuffer(buf);
        documentBufferView()->setCursorFromRow(row);
        return true;

Reply via email to