diff --git a/clay.h b/clay.h
index 9c75a9c..48b5e32 100644
--- a/clay.h
+++ b/clay.h
@@ -3180,7 +3180,9 @@ void Clay__RenderDebugView() {
             break;
         }
     }
-    int32_t highlightedRow = (int32_t)((Clay__pointerInfo.position.y - scrollYOffset) / (float)CLAY__DEBUGVIEW_ROW_HEIGHT) - 1;
+    int32_t highlightedRow = Clay__pointerInfo.position.y < Clay__layoutDimensions.height - 300
+            ? (int32_t)((Clay__pointerInfo.position.y - scrollYOffset) / (float)CLAY__DEBUGVIEW_ROW_HEIGHT) - 1
+            : -1;
     if (Clay__pointerInfo.position.x < Clay__layoutDimensions.width - (float)Clay__debugViewWidth) {
         highlightedRow = -1;
     }
diff --git a/examples/cpp-project-example/main.cpp b/examples/cpp-project-example/main.cpp
index ef215d9..f31e854 100644
--- a/examples/cpp-project-example/main.cpp
+++ b/examples/cpp-project-example/main.cpp
@@ -4,7 +4,6 @@
 
 Clay_LayoutConfig layoutElement = Clay_LayoutConfig { .padding = {5} };
 
-
 void HandleClayErrors(Clay_ErrorData errorData) {
     printf("%s", errorData.errorText.chars);
 }