tools: handle NULL svgs in ratbag-command

Showed up in #526
https://github.com/libratbag/libratbag/issues/526#issuecomment-420016451
This commit is contained in:
Peter Hutterer
2018-09-26 15:13:34 +10:00
parent 563c274705
commit 9551dddbb8

View File

@@ -292,7 +292,11 @@ class RatbagdDevice(metaclass=MetaRatbag):
@param theme The theme from which to retrieve the SVG, as str
"""
return os.path.join(LIBRATBAG_DATA_DIR, theme, libratbag.ratbag_device_get_svg_name(self._device))
svg = libratbag.ratbag_device_get_svg_name(self._device)
if svg is None:
return ''
return os.path.join(LIBRATBAG_DATA_DIR, theme, svg)
def get_svg_fd(self, theme):
"""Returns a File-like object to the SVG for the given theme, or