Cftry causes NullPointerException if used within cffinally in conjunction with <cfloop query="xxx">

Don’t forget to tell us about your stack!

OS: Win 10
Java Version: 1.8.0_271
Tomcat Version: 9.0.11
Lucee Version: 5.3.8.201

Getting a weird error here, no idea what to make of it. Anyone has any ideas?

<cftry>
  
  <cfcatch type="any">

  </cfcatch>
  <cffinally>
    <cfloop query="filesToMerge">
      <cftry>
        <cffile action="delete" file="#filesToMerge.name#">
        <cfcatch>
        </cfcatch>
      </cftry>
    </cfloop>
  </cffinally>
</cftry>  

This code does not produce the NullPointerException:

<cftry>
  
  <cfcatch type="any">

  </cfcatch>
  <cffinally>
    <cfloop collection="#filesToMerges#" index="index" item="filesToMerge">
      <cftry>
        <cffile action="delete" file="#filesToMerge.name#">
        <cfcatch>
        </cfcatch>
      </cftry>
    </cfloop>
  </cffinally>
</cftry>  

Somehow seems to be connected with the loop type being query maybe?

this seems related [LDEV-2456] - Lucee

please always post the top few lines of a stacktrace with a NPE or any other crash,

stack.txt (5.6 KB)

Ok, I will remember that for the future.

cheers, I have updated the task with a link to this and posted the top of the stacktrace

Its looks like NPE throws while using block ( like cfsavecontent, cftransaction, cfdocument) in cffinally block, which has another try-catch.