Fixed occasional crash when grouping on context.

The problem occurred when grouping matches on left context that have no
left context (because they occur at the start of the document).