diff --git a/src/nmreval/io/graceeditor.py b/src/nmreval/io/graceeditor.py index 44634fa..cdde89c 100644 --- a/src/nmreval/io/graceeditor.py +++ b/src/nmreval/io/graceeditor.py @@ -216,10 +216,9 @@ class GraceEditor: def _make_graph(self, line: str): m = self._RE_GRAPH_START.match(line) g_idx = int(m.group(1)) - if g_idx < len(self.graphs): + while g_idx < len(self.graphs): # this assumes that graphs are ordered in agr file even if missing, e.g. we read gß, g1, g3, ... - while g_idx != len(self.graphs): - self.graphs.append(GraceGraph(len(self.graphs))) + self.graphs.append(GraceGraph(len(self.graphs))) self.graphs.append(GraceGraph(g_idx))