Fix bug in gmx xpm2ps
authorPaul Bauer <paul.bauer.q@gmail.com>
Mon, 1 Jul 2019 09:17:04 +0000 (11:17 +0200)
committerPaul Bauer <paul.bauer.q@gmail.com>
Tue, 2 Jul 2019 07:06:50 +0000 (09:06 +0200)
When not providing the name for a library input file the program would
try to create a null string and fail with an assertion failure.

Fixes #3012

Change-Id: Ifd69af5420cdac2f624246aee09f36219b3f6aeb

docs/release-notes/2019/2019.4.rst
src/gromacs/gmxana/gmx_xpm2ps.cpp

index 5b28b662ad2d951edb3cc4e0bc204e14c9ecf27d..cf73fd0e1d20efba051c93994ec1704d1f45438b 100644 (file)
@@ -19,6 +19,13 @@ Fixes where mdrun could behave incorrectly
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
 
+Fix bug in gmx xpm2ps
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+The tool would fail when not being provided with a library file to read in.
+
+:issue:`3012`
+
 Fixes that affect portability
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
index caba460cd06edff3f482b0cfc26c487b0b734548..8a881e1640d1266f848cfd9d34a76c02d6452b1d 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -124,9 +124,9 @@ static void get_params(const char *mpin, const char *mpout, t_psrec *psr)
 
     wi = init_warning(FALSE, 0);
 
-    std::string libmpin = gmx::findLibraryFile(mpin);
-    if (!libmpin.empty())
+    if (mpin != nullptr)
     {
+        std::string        libmpin = gmx::findLibraryFile(mpin);
         gmx::TextInputFile stream(libmpin);
         inp = read_inpfile(&stream, libmpin.c_str(), wi);
     }
@@ -134,6 +134,7 @@ static void get_params(const char *mpin, const char *mpout, t_psrec *psr)
     {
         inp.clear();
     }
+
     psr->bw        = get_eenum(&inp, "black&white",             gmx_bools);
     psr->linewidth = get_ereal(&inp, "linewidth",      1.0, wi);
     setStringEntry(&inp, "titlefont",      psr->titfont,        "Helvetica");