]> git.lyx.org Git - lyx.git/commitdiff
* insetcite.C (getNatbibLabel): prevent filesystem exception
authorJürgen Spitzmüller <spitz@lyx.org>
Fri, 18 Aug 2006 16:03:48 +0000 (16:03 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Fri, 18 Aug 2006 16:03:48 +0000 (16:03 +0000)
if the bib file does not exist.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14805 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insetcite.C

index 7a0a641db2e166797f315fb540370ba191d08d18..ff2ee37b940a54e76c5551dc13cb6fadb63ce9d8 100644 (file)
@@ -16,6 +16,7 @@
 #include "buffer.h"
 #include "bufferparams.h"
 #include "BufferView.h"
+#include "debug.h"
 #include "dispatchresult.h"
 #include "funcrequest.h"
 #include "LaTeXFeatures.h"
@@ -33,6 +34,7 @@ using lyx::support::ltrim;
 using lyx::support::rtrim;
 using lyx::support::split;
 
+using std::endl;
 using std::string;
 using std::ostream;
 using std::vector;
@@ -68,7 +70,10 @@ string const getNatbibLabel(Buffer const & buffer,
        for (vector<string>::const_iterator it = bibfilesCache.begin();
                        it != bibfilesCache.end(); ++ it) {
                string const f = *it;
-               if (bibfileStatus[f] != fs::last_write_time(f)) {
+               if (!fs::exists(f)) {
+                       lyxerr << "Couldn't find bibtex file " << f << endl;
+                       changed = true;
+               } else if (bibfileStatus[f] != fs::last_write_time(f)) {
                        changed = true;
                        bibfileStatus[f] = fs::last_write_time(f);
                }