mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Fix potential crash in shader preprocess code
This commit is contained in:
parent
a13fb0e8ca
commit
e8fbd2f9da
@ -2382,7 +2382,7 @@ do_read_source(string &into, const Filename &fn, BamCacheRecord *record) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Strip trailing whitespace.
|
// Strip trailing whitespace.
|
||||||
while (isspace(into[into.size() - 1])) {
|
while (!into.empty() && isspace(into[into.size() - 1])) {
|
||||||
into.resize(into.size() - 1);
|
into.resize(into.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2528,7 +2528,7 @@ r_preprocess_source(ostream &out, const Filename &fn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Strip trailing whitespace.
|
// Strip trailing whitespace.
|
||||||
while (isspace(line[line.size() - 1])) {
|
while (!line.empty() && isspace(line[line.size() - 1])) {
|
||||||
line.resize(line.size() - 1);
|
line.resize(line.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user