aboutsummaryrefslogtreecommitdiff
path: root/sherlock_nk.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-11-22 22:21:17 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-11-22 22:21:17 +0100
commit99ed049721302715d4c689114d63d37cff655f02 (patch)
tree4a5223f85e8aa1351c5ad5813f646329f2bb316d /sherlock_nk.c
parentb5b2db8b7c69176157bdda8bfc0bbc4d0a18b329 (diff)
downloadsherlock.lv2-99ed049721302715d4c689114d63d37cff655f02.tar.xz
fix first seq counter index and mem overflow.
Diffstat (limited to 'sherlock_nk.c')
-rw-r--r--sherlock_nk.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sherlock_nk.c b/sherlock_nk.c
index 65233b5..d82c357 100644
--- a/sherlock_nk.c
+++ b/sherlock_nk.c
@@ -224,7 +224,7 @@ _clear(plughandle_t *handle)
_clear_items(handle);
nk_str_clear(&handle->str);
handle->selected = NULL;
- handle->counter = 0;
+ handle->counter = 1;
}
void
@@ -430,14 +430,16 @@ port_event(LV2UI_Handle instance, uint32_t i, uint32_t size, uint32_t urid,
}
case 2:
{
- if(handle->state.block)
+ const bool overflow = handle->n_item > MAX_LINES;
+
+ if(overflow && handle->state.overwrite)
{
- break;
+ _clear(handle);
}
- if( (handle->n_item > MAX_LINES) && handle->state.overwrite)
+ if(overflow || handle->state.block)
{
- _clear(handle);
+ break;
}
const LV2_Atom *atom = buf;