From de3e420c1e7e85e0d25a6086e81e471906d7962f Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 12 Jan 2024 18:48:12 +0100 Subject: [PATCH] DocSettings: Abort early if doc_path is nil or empty in findSidecarFile Regression from #11020 compared to the previous getSidecarFile behavior --- frontend/docsettings.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/docsettings.lua b/frontend/docsettings.lua index 0308755eb..c63db9322 100644 --- a/frontend/docsettings.lua +++ b/frontend/docsettings.lua @@ -153,8 +153,9 @@ end --- Returns path of `metadata.lua` file if it exists, or nil. -- @string doc_path path to the document (e.g., `/foo/bar.pdf`) -- @bool no_legacy set to true to skip check of the legacy history file --- @treturn string +-- @treturn string (or nil on failure) function DocSettings:findSidecarFile(doc_path, no_legacy) + if doc_path == nil or doc_path == "" then return nil end local sidecar_filename = DocSettings.getSidecarFilename(doc_path) local sidecar_file for _, location in ipairs(getOrderedLocationCandidates()) do