widgets.render_text(): error early if key is invalid

This helps identify _which_ key is invalid - otherwise, getKeyDisplay()
complains that it was called with `nil`, which is less helpful.
develop
lethosor 2022-12-23 13:17:26 -05:00
parent 12804a10a6
commit 6a61c750e9
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 3 additions and 0 deletions

@ -1027,6 +1027,9 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled)
end
if token.key then
if type(token.key) == 'string' and not df.interface_key[token.key] then
error('Invalid interface_key: ' .. token.key)
end
local keystr = gui.getKeyDisplay(token.key)
local sep = token.key_sep or ''