jtackaberry / reaticulate

An articulation management system for REAPER
Other
101 stars 46 forks source link

Reaticulate is crashed if icon description or color description is wrong #13

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi,

For example, while I'm creating new bank presets and I put some undefined icon, color descriptions, plugin will crash if you reload it.

I would suggest something like (pseudo):

if color.exists? ? parse(color) : 'undefined color'

That way we'll have just "undefined : undefined" on GUI, but we'll avoid crash.

jtackaberry commented 6 years ago

Thanks for the report. Can you share the specific bank definition that triggered the crash?

ghost commented 6 years ago

Error is:

...Data\Roaming\REAPER\Scripts\Reaticulate\\app\lib\rtk.lua:36: attempt to index a nil value (local 's')

For example, instead:

//! c=textured i=fall o=cc:32,101
101 fall

you put this for color:

//! c=fall i=fall o=cc:32,101
101 fall

fall is non existent color in your array I suppose.

jtackaberry commented 6 years ago

Yep, makes sense. Cheers.

ghost commented 6 years ago

https://github.com/jtackaberry/reaticulate/blob/master/app/articons.lua#L32

return articons.icons[name] || 'undefined'

Or even you can include undefined icon in your png, so when you handle undefined you should represent icon with question mark for example.

jtackaberry commented 6 years ago

articons.get() should return nil for an unknown icon name. Also that'd be unrelated to the color, but it's possible they both aren't as robust as they should be.

This is supposed to be handled here: https://github.com/jtackaberry/reaticulate/blob/master/app/reabank.lua#L225

Specifically:

 local color = art.color or reabank.colors.default
-- [...]
 art.icon = articons.get(art.iconname or 'note-eighth')

So you can see the intention there. Should be quite an easy fix, really, but I won't be in front of my DAW until tonight.

jtackaberry commented 6 years ago

Something like:

art.icon = articons.get(art.iconname) or articons.get('note-eighth')

should do.

At first blush, though, not sure why you're seeing problems with the color. Will dig in tonight.

jtackaberry commented 6 years ago

Scratch that: yes, it's obvious why specifying an invalid color horks. Easy fix there too.