diff --git a/src/osg/Shader.cpp b/src/osg/Shader.cpp index 77e03e38c..2f7681b17 100644 --- a/src/osg/Shader.cpp +++ b/src/osg/Shader.cpp @@ -702,7 +702,7 @@ void Shader::PerContextShader::compileShader(osg::State& state) if ((end_of_line-start_of_line)>=8 && source.compare(start_of_line, 8, "#version")==0) { versionLine = source.substr(start_of_line, end_of_line-start_of_line+1); - if (source[source.size()-1]!='\n') source.push_back('\n'); + if (versionLine[versionLine.size()-1]!='\n') versionLine.push_back('\n'); source.insert(start_of_line, "// following version spec has been automatically reassigned to start of source list: ");