diff options
-rw-r--r-- | protocols/Twitter/src/utility.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index b7198723e2..e693d0b0e7 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -88,13 +88,15 @@ bool save_url(HNETLIBUSER hNetlib, const CMStringA &url, const CMStringW &filena return false;
// Create folder if necessary
- CreatePathToFileW(filename);
+ if (CreatePathToFileW(filename) != ERROR_SUCCESS)
+ return false;
// Write to file
- FILE *f = _wfopen(filename, L"wb");
- if (resp->pData && !IsBadReadPtr(resp->pData, resp->dataLength))
+ if (FILE *f = _wfopen(filename, L"wb")) {
fwrite(resp->pData, 1, resp->dataLength, f);
- fclose(f);
+ fclose(f);
+ }
+ else return false;
return true;
}
|