From 7ab553d72a14c04be1aa7e787eeef360be7bb619 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 10 Jun 2011 22:30:03 +0200 Subject: COMMON: Do not try to read from res forks of non-existant files --- common/macresman.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/common/macresman.cpp b/common/macresman.cpp index 6cbc08da19..c1cab8b96a 100644 --- a/common/macresman.cpp +++ b/common/macresman.cpp @@ -107,14 +107,17 @@ bool MacResManager::open(String filename) { #ifdef MACOSX // Check the actual fork on a Mac computer String fullPath = ConfMan.get("path") + "/" + filename + "/..namedfork/rsrc"; - SeekableReadStream *macResForkRawStream = FSNode(fullPath).createReadStream();; + FSNode resFsNode = FSNode(fullPath); + if (resFsNode.exists()) { + SeekableReadStream *macResForkRawStream = resFsNode.createReadStream();; - if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) { - _baseFileName = filename; - return true; - } + if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) { + _baseFileName = filename; + return true; + } - delete macResForkRawStream; + delete macResForkRawStream; + } #endif File *file = new File(); @@ -167,14 +170,17 @@ bool MacResManager::open(FSNode path, String filename) { #ifdef MACOSX // Check the actual fork on a Mac computer String fullPath = path.getPath() + "/" + filename + "/..namedfork/rsrc"; - SeekableReadStream *macResForkRawStream = FSNode(fullPath).createReadStream(); + FSNode resFsNode = FSNode(fullPath); + if (resFsNode.exists()) { + SeekableReadStream *macResForkRawStream = resFsNode.createReadStream();; - if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) { - _baseFileName = filename; - return true; - } + if (macResForkRawStream && loadFromRawFork(*macResForkRawStream)) { + _baseFileName = filename; + return true; + } - delete macResForkRawStream; + delete macResForkRawStream; + } #endif // First, let's try to see if the Mac converted name exists -- cgit v1.2.3