diff options
| author | Shawn Hoffman <godisgovernment@gmail.com> | 2020-08-17 17:24:03 -0700 |
|---|---|---|
| committer | Shawn Hoffman <godisgovernment@gmail.com> | 2020-08-23 13:55:14 -0700 |
| commit | 49590c9a42d8d6912f87d70eb92ad369c1a992d5 (patch) | |
| tree | dbbfa0dbd59dd62a793c00f503bf4268aa482517 /Source/Core/Common/FileUtil.cpp | |
| parent | 3bc8a26083549087c3bb285d5742a71160ae146b (diff) | |
FileUtil: handle some error conditions
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index d5ba4d03a0..b3efa6b868 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -600,7 +600,7 @@ std::string GetCurrentDir() if (!dir) { ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", LastStrerrorString().c_str()); - return nullptr; + return ""; } std::string strDir = dir; free(dir); @@ -621,10 +621,15 @@ std::string CreateTempDir() return ""; GUID guid; - CoCreateGuid(&guid); - TCHAR tguid[40]; - StringFromGUID2(guid, tguid, 39); - tguid[39] = 0; + if (FAILED(CoCreateGuid(&guid))) + { + return ""; + } + OLECHAR tguid[40]{}; + if (!StringFromGUID2(guid, tguid, _countof(tguid))) + { + return ""; + } std::string dir = TStrToUTF8(temp) + "/" + TStrToUTF8(tguid); if (!CreateDir(dir)) return ""; |
