From 23215b4ceade7cfc3453b01243d2c41d86e4f68d Mon Sep 17 00:00:00 2001 From: Douglas Stephen Date: Thu, 4 Dec 2025 15:08:52 -0600 Subject: [PATCH 1/2] Add nil checks for name and file in sortDoc `name` and `file` don't appear to be guaranteed non-nil; because of this, if there are cases where the key is present on one element but not the other, the equality check will fall through to the less-than check and this results in a crash comparing `string` against `nil`. Resolves: https://github.com/LuaLS/lua-language-server/issues/3111 --- script/cli/doc/export.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/cli/doc/export.lua b/script/cli/doc/export.lua index cd356b167..4c1403099 100644 --- a/script/cli/doc/export.lua +++ b/script/cli/doc/export.lua @@ -72,11 +72,11 @@ function export.positionOf(rowcol) end function export.sortDoc(a,b) - if a.name ~= b.name then + if a.name and b.name and a.name ~= b.name then return a.name < b.name end - if a.file ~= b.file then + if a.file and b.file and a.file ~= b.file then return a.file < b.file end From b5663a2bc06a21134f9c80952d7ec5f5110010ed Mon Sep 17 00:00:00 2001 From: Douglas Stephen Date: Thu, 4 Dec 2025 15:12:34 -0600 Subject: [PATCH 2/2] Update CHANGELOG.md --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index b6caa5050..6dd682698 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## Unreleased +* `FIX` Comparison crash in doc export CLI [#3111](https://github.com/LuaLS/lua-language-server/issues/3111) ## 3.16.0 `2025-12-2`