diff --git a/lib/wibox/drawable.lua.in b/lib/wibox/drawable.lua.in index 6728f4e3..774bf26d 100644 --- a/lib/wibox/drawable.lua.in +++ b/lib/wibox/drawable.lua.in @@ -19,7 +19,10 @@ local surface = require("gears.surface") local drawables = setmetatable({}, { __mode = 'k' }) local function do_redraw(self) - local cr = cairo.Context(surface(self.drawable.surface)) + local surf = surface(self.drawable.surface) + -- The surface can be nil if the drawable's parent was already finalized + if not surf then return end + local cr = cairo.Context(surf) local geom = self.drawable:geometry(); local x, y, width, height = geom.x, geom.y, geom.width, geom.height