summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/saw/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/saw/main.c b/source/saw/main.c
index 81ed0ee..56c1f87 100644
--- a/source/saw/main.c
+++ b/source/saw/main.c
@@ -569,6 +569,10 @@ static void saw_ui_compose(i64 x0, i64 y0, i64 width, i64 height) {
1;
i64 cell = ((saw_mouse_x - saw_compose.offset_x) * grid_rate) /
grid_scale;
+
+ if (cell < 0 || track < 0 || track >= TRACK_COUNT)
+ break;
+
i64 frame = (cell * SAW_SAMPLE_RATE) / grid_rate;
i64 n = -1;