Skip to content

Commit

Permalink
Added file reading check
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul1365972 authored and LovelySanta committed Nov 11, 2019
1 parent ccccfdc commit 6e84e8d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Hazel/src/Platform/OpenGL/OpenGLShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,19 @@ namespace Hazel {
if (in)
{
in.seekg(0, std::ios::end);
result.resize(in.tellg());
in.seekg(0, std::ios::beg);
in.read(&result[0], result.size());
in.close();
; }
size_t size = in.tellg();
if (size != -1)
{
result.resize(size);
in.seekg(0, std::ios::beg);
in.read(&result[0], size);
in.close();
}
else
{
HZ_CORE_ERROR("Could not read from file '{0}'", filepath);
}
}
else
{
HZ_CORE_ERROR("Could not open file '{0}'", filepath);
Expand Down

0 comments on commit 6e84e8d

Please sign in to comment.