Merge branch release-2018 into release-2019
[alexxy/gromacs.git] / src / gromacs / fileio / tpxio.cpp
index 8ce2b60ec27b767ed385e3a0d028c8438c781177..2efb336f97fdba2b37c581a63fe62227f86e3cd5 100644 (file)
@@ -3003,7 +3003,10 @@ int read_tpx(const char *fn,
     fio     = open_tpx(fn, "r");
     ePBC    = do_tpx(fio, TRUE, ir, &state, x, v, mtop);
     close_tpx(fio);
-    *natoms = mtop->natoms;
+    if (mtop != nullptr && natoms != nullptr)
+    {
+        *natoms = mtop->natoms;
+    }
     if (box)
     {
         copy_mat(state.box, box);