summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-10-01 22:16:05 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-10-01 22:16:05 +0200
commit7c7c2e9213de6bfc68b60609141bf0881d084d5d (patch)
treec4db88549d0e663b8605371c639d5f17df6df7a8
parent09e6882619596bceed7083098ed9b5c239480f31 (diff)
downloadsaw-7c7c2e9213de6bfc68b60609141bf0881d084d5d.zip
Fix invalid duplicate position
-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;