diff --git a/Source/Core/ShaderConductor.cpp b/Source/Core/ShaderConductor.cpp index eb39eb2..d3de64a 100644 --- a/Source/Core/ShaderConductor.cpp +++ b/Source/Core/ShaderConductor.cpp @@ -245,13 +245,16 @@ namespace { std::vector ret; std::ifstream includeFile(includeName, std::ios_base::in); - includeFile.seekg(0, std::ios::end); - ret.resize(includeFile.tellg()); - includeFile.seekg(0, std::ios::beg); - includeFile.read(ret.data(), ret.size()); - while (!ret.empty() && (ret.back() == '\0')) + if (includeFile) { - ret.pop_back(); + includeFile.seekg(0, std::ios::end); + ret.resize(includeFile.tellg()); + includeFile.seekg(0, std::ios::beg); + includeFile.read(ret.data(), ret.size()); + while (!ret.empty() && (ret.back() == '\0')) + { + ret.pop_back(); + } } return std::string(ret.data(), ret.size()); }