summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-12-21 17:34:33 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-12-23 11:42:23 -0500
commit56d47935845c312189fdc8a05f0bb08935632478 (patch)
tree2a152d610047160b59eeffb22b8cd328b35542d0 /editor
parent28c1f86dcd059ff4ce8d14d9c9a00c9c35b1b6f0 (diff)
don't set the debug hitbox to an entity without an instance
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index f5e0d8d..5016070 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -229,12 +229,19 @@ void PkeEditor_Tick(double delta) {
}
EntityHandle focusedHandle = selectedEntity != EntityHandle_MAX ? selectedEntity : hoveredEntity;
+ bool found = false;
if (focusedHandle != EntityHandle_MAX) {
const auto *inst = ECS_GetInstance(focusedHandle);
- const auto *grBinds = ECS_GetGrBinds(inst->grBindsHandle);
- pkeDebugHitbox.instanceBuffer = grBinds->instanceBuffer;
- pkeDebugHitbox.instanceStartingIndex = inst->index;
- } else {
+ if (inst != nullptr) {
+ const auto *grBinds = ECS_GetGrBinds(inst->grBindsHandle);
+ if (grBinds != nullptr) {
+ pkeDebugHitbox.instanceBuffer = grBinds->instanceBuffer;
+ pkeDebugHitbox.instanceStartingIndex = inst->index;
+ found = true;
+ }
+ }
+ }
+ if (!found) {
pkeDebugHitbox.instanceBuffer = VK_NULL_HANDLE;
pkeDebugHitbox.instanceStartingIndex = 0;
}