commit 562ad5e94b1acc1e30cf81fb3df8240e20577e8d
Author: Scott Kostyshak <[email protected]>
Date:   Sat Jul 19 13:11:24 2025 +0200

    Fix assert for command-line export and no user dir
    
    Before, we would get an assertion with the following:
    
      lyx -userdir DOES_NOT_EXIST -e pdf2 lib/examples/Welcome.lyx
    
    With this commit, we no longer assert without GUI. There is still a
    relevant error and non-zero exit code:
    
      $ lyx -e pdf2 ./lib/examples/Welcome.lyx
      Missing user LyX directory
      ----------------------------------------
      You have specified a non-existent user LyX directory, 
/path/to/DOES_NOT_EXIST.
      It is needed to keep your own configuration.
      Assuming answer is &Exit LyX
      No user LyX directory. Exiting.
      $ echo $?
      1
---
 src/LyX.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/LyX.cpp b/src/LyX.cpp
index f96354c78d..023440d6f9 100644
--- a/src/LyX.cpp
+++ b/src/LyX.cpp
@@ -436,7 +436,9 @@ void LyX::prepareExit()
 
 void LyX::earlyExit(int status)
 {
-       LATTEST(pimpl_->application_.get());
+       if (use_gui) {
+               LATTEST(pimpl_->application_.get());
+       }
        // LyX::pimpl_::application_ is not initialised at this
        // point so it's safe to just exit after some cleanup.
        prepareExit();
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to