File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,10 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist)
389
389
390
390
// remove .xxx
391
391
size_t startPos = texturePath.find_last_of (' .' );
392
- texturePath = texturePath.erase (startPos);
392
+ if (startPos != string::npos)
393
+ {
394
+ texturePath = texturePath.erase (startPos);
395
+ }
393
396
394
397
// append .png
395
398
texturePath = texturePath.append (" .png" );
@@ -691,8 +694,11 @@ bool SpriteFrameCache::reloadTexture(const std::string& plist)
691
694
692
695
// remove .xxx
693
696
size_t startPos = texturePath.find_last_of (' .' );
694
- texturePath = texturePath.erase (startPos);
695
-
697
+ if (startPos != string::npos)
698
+ {
699
+ texturePath = texturePath.erase (startPos);
700
+ }
701
+
696
702
// append .png
697
703
texturePath = texturePath.append (" .png" );
698
704
}
You can’t perform that action at this time.
0 commit comments