Fix condition where captures could be a nil rather than an empty map.