fixed possible segfault when attempting to preview corrupted files