From 67e2b57e0fbdfea3f4e0e73ba06af2e69e0da1fa Mon Sep 17 00:00:00 2001 From: sum2012 Date: Fri, 24 Oct 2014 22:21:49 +0800 Subject: [PATCH] Add a result != S_OK check --- UI/GameSettingsScreen.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 779f534c3f..393476eb54 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -424,27 +424,26 @@ void GameSettingsScreen::CreateViews() { else { if (installed && (result == S_OK)) { std::ifstream inputFile(ConvertUTF8ToWString(installedFile)); - if (!inputFile.fail() && inputFile.is_open()) { - SavePathInMyDocumentChoice->OnClick.Handle(this, &GameSettingsScreen::OnSavePathMydoc); - std::string tempString; - - std::getline(inputFile, tempString); - - // Skip UTF-8 encoding bytes if there are any. There are 3 of them. - if (tempString.substr(0, 3) == "\xEF\xBB\xBF") - tempString = tempString.substr(3); - if (tempString == ""){ - SavePathInMyDocumentChoice->SetEnabled(true); + if (!inputFile.fail() && inputFile.is_open()) { SavePathInMyDocumentChoice->OnClick.Handle(this, &GameSettingsScreen::OnSavePathMydoc); + std::string tempString; + std::getline(inputFile, tempString); + + // Skip UTF-8 encoding bytes if there are any. There are 3 of them. + if (tempString.substr(0, 3) == "\xEF\xBB\xBF") + if (tempString == ""){ + SavePathInMyDocumentChoice->OnClick.Handle(this, &GameSettingsScreen::OnSavePathMydoc); + } + else { + installed = false; + otherinstalled = true; + SavePathInOtherChoice->SetEnabled(true); + } } - else { - installed = false; - otherinstalled = true; - SavePathInOtherChoice->SetEnabled(true); - } - } - inputFile.close(); + inputFile.close(); } + else if (result != S_OK) + SavePathInMyDocumentChoice->SetEnabled(false); } #endif