fix: safe check when computing chart thumbnail (#23432)

This commit is contained in:
Zef Lin 2023-03-21 09:13:38 -07:00 committed by GitHub
parent 7ef06b0a60
commit 226b60bc4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,9 @@ def cache_chart_thumbnail(
logger.warning("No cache set, refusing to compute")
return None
chart = cast(Slice, Slice.get(chart_id))
if not chart:
logger.warning("No chart found, skip computing chart thumbnail")
return None
url = get_url_path("Superset.slice", slice_id=chart.id)
logger.info("Caching chart: %s", url)
_, username = get_executor(