All boost filesystem functions should be handled using error code to prevent random crashes caused by inaccesible files or directories. Increment in iterator should use separate error code variable because it have to be handled specifically to prevent infinite loop in diving to inaccessible directories.
To prevent coding errors in future the lint test is added to check if error code parameters are present.
Previous conversation about issue in #18095