about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-12-15 20:13:49 +0100
committerbptato <nincsnevem662@gmail.com>2023-12-15 20:13:49 +0100
commit089d974b245734042b0a01a28b1cca74de765b3b (patch)
treea4e4bcff62e0800b6092480e63545f15dfbc1d14 /src/config
parentb8cb40fd46e1d41925198ff171b9fbf8362bc924 (diff)
downloadchawan-089d974b245734042b0a01a28b1cca74de765b3b.tar.gz
config/toml: fix consumeComment overriding nodes
We must first check if there is really no node to attach the comment
to...
Diffstat (limited to 'src/config')
-rw-r--r--src/config/toml.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim
index 9932cc83..4440dff4 100644
--- a/src/config/toml.nim
+++ b/src/config/toml.nim
@@ -298,7 +298,8 @@ proc flushLine(state: var TomlParser): Err[TomlError] =
   return ok()
 
 proc consumeComment(state: var TomlParser) =
-  state.node = TomlNode()
+  if state.node == nil:
+    state.node = TomlNode()
   while state.has():
     let c = state.consume()
     if c == '\n':