From d42c5fcd233a17c1693fd4de3702fc2ad998592d Mon Sep 17 00:00:00 2001 From: Scott Kostyshak Date: Fri, 29 Mar 2013 11:34:04 -0400 Subject: [PATCH] Exit with error if required filename is not given This is a second attempt to fix the problem described in 6df4a7bb (2c2c1767 reverted the first attempt). The solution here is more general: if we get to a certain point in the code and there is no filename, an error is given. The following command now gives an error: lyx -e pdf2 And the following command continues to not give an error: lyx myfile.lyx -e pdf --- src/LyX.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/LyX.cpp b/src/LyX.cpp index 2096be7a77..55fb0711ad 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -468,6 +468,11 @@ int LyX::init(int & argc, char * argv[]) for (int argi = 1; argi < argc; ++argi) pimpl_->files_to_load_.push_back(os::utf8_argv(argi)); + if (!use_gui && pimpl_->files_to_load_.empty()) { + lyxerr << to_utf8(_("Missing filename for this operation.")) << endl; + return EXIT_FAILURE; + } + if (first_start) { pimpl_->files_to_load_.push_back( i18nLibFileSearch("examples", "splash.lyx").absFileName()); -- 2.39.2