Skip to content

Commit 7693128

Browse files
authored
Merge pull request #1403 from mdbraber/master
Fix srcToken error
2 parents 4ef12b1 + cce4f98 commit 7693128

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/rules/yaml-key-sort.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export default class YamlKeySort extends RuleBuilder<YamlKeySortOptions> {
6363
const doc = parseYAML(yamlText);
6464
const startingPriorityKeys = getEmptyDocument(doc);
6565

66+
if (doc.contents == null) {
67+
return text;
68+
}
69+
6670
let remainingKeys = this.getYAMLKeysSorted(yamlKeys, doc, startingPriorityKeys);
6771

6872
const sortOrder = options.yamlSortOrderForOtherKeys;

0 commit comments

Comments
 (0)