Shouldn't it be :
if (node->box_shadow_material && node->box_shadow_material != COGL_INVALID_HANDLE)