file: fix segfault
Merge pull request #1794 from stefansaraev/file

file: fix segfault