Fix a crash when buffer is not defined on files