From 5310d6d2ea0233f745aa6fc9884930f7d30d4fee Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 23 Mar 2014 22:29:30 -0500 Subject: [PATCH] Fix a crash that got recently introduced. When CFileSystemGCWii::GetFileName can't find a valid filename it would return nullptr. nullptr as a std::string throws an assert within the std lib. So return an empty string and check if it is empty or not --- Source/Core/DiscIO/FileMonitor.cpp | 3 +++ Source/Core/DiscIO/FileSystemGCWii.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/DiscIO/FileMonitor.cpp b/Source/Core/DiscIO/FileMonitor.cpp index d99bd14cd8..4743e7c1af 100644 --- a/Source/Core/DiscIO/FileMonitor.cpp +++ b/Source/Core/DiscIO/FileMonitor.cpp @@ -143,6 +143,9 @@ void FindFilename(u64 offset) } const std::string filename = pFileSystem->GetFileName(offset); + + if (filename.empty()) + return; CheckFile(filename, pFileSystem->GetFileSize(filename)); } diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp index f9f88e8d02..cdd830c6f6 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/FileSystemGCWii.cpp @@ -60,7 +60,7 @@ const std::string CFileSystemGCWii::GetFileName(u64 _Address) } } - return nullptr; + return ""; } u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize)