Correctly fix the segfault if no mask is provided.