From e8fbd2f9dac83c7ff1e3085efbd50718714563ab Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 21 Dec 2016 18:14:46 +0100 Subject: [PATCH] Fix potential crash in shader preprocess code --- panda/src/gobj/shader.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index 306f76f6f8..27a055a794 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -2382,7 +2382,7 @@ do_read_source(string &into, const Filename &fn, BamCacheRecord *record) { } // Strip trailing whitespace. - while (isspace(into[into.size() - 1])) { + while (!into.empty() && isspace(into[into.size() - 1])) { into.resize(into.size() - 1); } @@ -2528,7 +2528,7 @@ r_preprocess_source(ostream &out, const Filename &fn, } // Strip trailing whitespace. - while (isspace(line[line.size() - 1])) { + while (!line.empty() && isspace(line[line.size() - 1])) { line.resize(line.size() - 1); }