summaryrefslogtreecommitdiff
path: root/comments.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-08-28 16:34:30 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-08-28 16:34:30 +0200
commit0339b8cd5a472d319b9d4b6c499c35d17f2d8e8e (patch)
tree3ba0d21b63c81805d52089c6b918580a00c6942a /comments.py
parent9c0ecea7cdc8f3ae5fbd125a7b059d6f6dc81669 (diff)
downloadruamel.yaml-0339b8cd5a472d319b9d4b6c499c35d17f2d8e8e.tar.gz
fix issue 397 inserting comment when post key comment exists0.17.15
Diffstat (limited to 'comments.py')
-rw-r--r--comments.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/comments.py b/comments.py
index 6d1c4d8..6d2eb6b 100644
--- a/comments.py
+++ b/comments.py
@@ -394,6 +394,8 @@ class CommentedBase:
if before == '\n':
c[1].append(comment_token("", start_mark))
elif before:
+ if c[1] is None:
+ c[1] = []
for com in before.split('\n'):
c[1].append(comment_token(com, start_mark))
if after: