ximion / appstream-generator

A fast AppStream metadata generator
GNU Lesser General Public License v3.0
43 stars 29 forks source link

config: Move setUseOptipng call after we determine if optipng is available #93

Closed iainlane closed 3 years ago

iainlane commented 3 years ago

Currently we tell AsCompose to use optipng just based on the value of the feature flag. AsCompose will respect what we tell it without further checking. If optipng is in fact not available then we'll crash later on when we first try to use it.

Fix this by setting the flag after we check if optipng is installed.

iainlane commented 3 years ago

btw I think that crashing is kind of dodgy behaviour. Should asc_globals_set_use_optipng be lookng at priv->optipng_bin and refusing to set to TRUE if that is NULL (logging a critical)?

ximion commented 3 years ago

btw I think that crashing is kind of dodgy behaviour. Should asc_globals_set_use_optipng be lookng at priv->optipng_bin and refusing to set to TRUE if that is NULL (logging a critical)?

Oh, it absolutely should do that! Crashing is never acceptable (unless it's an assertion in tests or a g_error in other code). Thanks for the patch!