Skip to content

Commit

Permalink
Merge pull request #3519 from Autodesk/azharia/EMSUSD-808/fixes-strin…
Browse files Browse the repository at this point in the history
…g-check

EMSUSD-808 - Fixes an out of range crash that only occurs in Debug mode
  • Loading branch information
neilh-adsk authored Dec 15, 2023
2 parents c16e588 + 5fc6088 commit 4293d7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/usdUfe/utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ std::string prettifyName(const std::string& name)
bool capitalizeNext = true;
for (size_t i = 0; i < nbChars; ++i) {
unsigned char nextLetter = name[i];
if (std::isupper(name[i]) && !std::isdigit(name[i - 1])) {
if (std::isupper(name[i]) && i > 0 && !std::isdigit(name[i - 1])) {
if ((i > 0 && (i < (nbChars - 1)) && !std::isupper(name[i + 1]))
|| std::islower(name[i - 1])) {
prettyName += ' ';
Expand Down
1 change: 1 addition & 0 deletions test/lib/ufe/testAttribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,7 @@ def testNamePrettification(self):
self.assertEqual(mayaUsdLib.Util.prettifyName("ior"), "Ior")
self.assertEqual(mayaUsdLib.Util.prettifyName("IOR"), "IOR")
self.assertEqual(mayaUsdLib.Util.prettifyName("specular_IOR"), "Specular IOR")
self.assertEqual(mayaUsdLib.Util.prettifyName("HwPtexTexture"), "Hw Ptex Texture")
# This is as expected as we do not insert space on digit<->alpha transitions:
self.assertEqual(mayaUsdLib.Util.prettifyName("Dx11Shader"), "Dx11Shader")
# Explicit substitutions
Expand Down

0 comments on commit 4293d7f

Please sign in to comment.