[vlc-devel] [PATCH] lua/intf/cli: fix invalid concatenation of empty string

Pierre Ynard linkfanel at yahoo.fr
Wed Oct 26 15:17:19 CEST 2016


> -            local str = "| "..prefix..tostring(item.id).." - "..item.name
> +            local str = "| "..prefix..tostring(item.id)..
> +                            (item.name == nil and "" or " - "..item.name)

In lua, only nil and false evaluate to false in boolean context, so I
think the "== nil" is redundant.

Also, I don't find this very helpful as you end up with a blank entry,
that possibly won't play correctly, with no obvious way to query info
about it. Perhaps it would be more helpful to display something else
instead if the name is missing.

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list