Fix a bug where exporting to an empty file path caused crash