For details, check the individual commit messages.
I suspect this is a result of https://github.com/geany/geany/pull/3891 and some different timings of when the affected functions get called. I haven't investigated the exact reasons, the extra added checks are probably just fine. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3921
-- Commit Summary --
* Fix runtime warning when opening Geany without open files * Fix runtime warning when closing project to a session without open files
-- File Changes --
M src/document.c (6)
-- Patch Links --
https://github.com/geany/geany/pull/3921.patch https://github.com/geany/geany/pull/3921.diff