From 0024a4370c8ca85640d2c3f021070bcc094e0119 Mon Sep 17 00:00:00 2001 From: Learath Lea Date: Sun, 29 Mar 2015 00:41:58 +0200 Subject: [PATCH] Catch an IO error --- src/engine/client/fetcher.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine/client/fetcher.cpp b/src/engine/client/fetcher.cpp index 3eacf5f9e..187f7da0a 100644 --- a/src/engine/client/fetcher.cpp +++ b/src/engine/client/fetcher.cpp @@ -100,6 +100,12 @@ void CFetcher::FetchFile(CFetchTask *pTask) m_pStorage->GetCompletePath(pTask->m_StorageType, pTask->m_pDest, aPath, sizeof(aPath)); IOHANDLE File = io_open(aPath, IOFLAG_WRITE); + if(!File){ + dbg_msg("fetcher", "I/O Error cannot open file: %s", pTask->m_pDest); + pTask->m_State = CFetchTask::STATE_ERROR; + return; + } + char aCAFile[512]; m_pStorage->GetBinaryPath("data/ca-ddnet.pem", aCAFile, sizeof aCAFile);