In working on the InsetCommand stuff, I ran across this. Somethind should be done here, but I'm not sure what and will make a proposal.

The patch is attached. The issue is with the test
   if (!p.getCmdName().empty()) {
The problem is that, so far as I can see, there is absolutely no way this can trigger. So I'm proposing to replace it with a try-catch block: string2params throws an exception when it encounters an error, so we can catch it and act appropriately. Does this seem reasonable?

Richard

--

==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Index: /cvs/lyx-devel/branches/personal/rgheck/icp/src/insets/InsetBibtex.cpp
===================================================================
--- /cvs/lyx-devel/branches/personal/rgheck/icp/src/insets/InsetBibtex.cpp	(.../trunk)	(revision 20491)
+++ /cvs/lyx-devel/branches/personal/rgheck/icp/src/insets/InsetBibtex.cpp	(.../branches/personal/rgheck/icp)	(working copy)
@@ -26,6 +26,7 @@
 
 #include "frontends/alert.h"
 
+#include "support/ExceptionMessage.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
@@ -90,12 +91,14 @@
 
 	case LFUN_INSET_MODIFY: {
 		InsetCommandParams p("bibtex");
-		InsetCommandMailer::string2params("bibtex", to_utf8(cmd.argument()), p);
-		if (!p.getCmdName().empty()) {
+		try {
+			InsetCommandMailer::string2params("bibtex", to_utf8(cmd.argument()), p);
 			setParams(p);
 			cur.buffer().updateBibfilesCache();
-		} else
+		}
+		catch (support::ExceptionMessage) {
 			cur.noUpdate();
+		}
 		break;
 	}
 

Reply via email to