Index: ogr/swq.c
===================================================================
--- ogr/swq.c	(revision 14404)
+++ ogr/swq.c	(working copy)
@@ -2367,6 +2367,9 @@
         select_info->column_defs[0].field_index )
         return "Only selected DISTINCT field can be used for ORDER BY.";
 
+    if( select_info->column_summary == NULL )
+        return NULL;
+
     if( select_info->column_defs[0].field_type == SWQ_INTEGER )
         compare_func = swq_compare_int;
     else if( select_info->column_defs[0].field_type == SWQ_FLOAT )

