Adds an extra check in DmsfQuery#dmsf_node

This change stablizes the query with DmsfLink objects since they could
have stored a project_id of -1 causing a nil error.

This may happen when the linking of a dms document with an issue was
not successful or aborted as observed with https://github.com/danmunn/redmine_dmsf/pull/1466.
This commit is contained in:
Liane Hampe 2024-01-30 19:33:18 +01:00
parent 29a3b9231a
commit d577f559e1

View File

@ -230,7 +230,7 @@ class DmsfQuery < Query
dmsf_link = DmsfLink.find_by(id: item.id)
if dmsf_link.dmsf_folder
!dmsf_link.dmsf_folder.visible? || !DmsfFolder.permissions?(dmsf_link.dmsf_folder, allow_system: false)
else
elsif dmsf_link.project
!dmsf_link.project.dmsf_available?
end
else