From e2c7f5ba75e5a0a779337af7d7a463800ef22074 Mon Sep 17 00:00:00 2001
From: Shaun Reed <shaunrd0@gmail.com>
Date: Sat, 15 Mar 2025 11:31:16 -0400
Subject: [PATCH] Fix bug in unique object names.

---
 src/qtk/scene.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/qtk/scene.cpp b/src/qtk/scene.cpp
index 67ba4e4..150d0ca 100644
--- a/src/qtk/scene.cpp
+++ b/src/qtk/scene.cpp
@@ -118,10 +118,8 @@ void Scene::setSkybox(Skybox * skybox)
 
 void Scene::initSceneObjectName(Object * object)
 {
-  mObjectCount[object->getName()] = mObjectCount.count(object->getName()) + 1;
-
-  // If the object exists make it's name unique.
-  auto count = mObjectCount[object->getName()];
+  // If the object name exists make it unique.
+  auto count = ++mObjectCount[object->getName()];
   if (count > 1) {
     object->setName(object->getName() + " (" + std::to_string(count) + ")");
   }