diff --git a/libgxps/gxps-page.c b/libgxps/gxps-page.c
index c1dfb7e..1c7628f 100644
--- a/libgxps/gxps-page.c
+++ b/libgxps/gxps-page.c
@@ -201,16 +201,18 @@ gxps_page_render_parser_push (GMarkupParseContext *context,
 }
 
 static gboolean
-gxps_dash_array_parse (const gchar *dash,
-		       gdouble    **dashes_out,
-		       guint       *num_dashes_out)
+gxps_dash_array_parse (const gchar *dash, gdouble **dashes_out,
+		               guint *num_dashes_out)
 {
-	gchar  **items;
-	guint    i;
-        gdouble *dashes;
-        guint    num_dashes;
-
-	items = g_strsplit (dash, " ", -1);
+	gchar **items, *_dash;
+	guint i;
+	gdouble *dashes;
+	guint num_dashes;
+
+	_dash = g_strdup (dash);
+	g_strstrip (_dash);
+	items = g_strsplit (_dash, " ", -1);
+	g_free (_dash);
 	if (!items)
 		return FALSE;
 
@@ -218,18 +220,20 @@ gxps_dash_array_parse (const gchar *dash,
 	dashes = g_malloc (num_dashes * sizeof (gdouble));
 
 	for (i = 0; i < num_dashes; i++) {
-                if (!gxps_value_get_double (items[i], &dashes[i])) {
-                        g_free (dashes);
-                        g_strfreev (items);
+		if (!gxps_value_get_double (items[i], &dashes[i])) {
+			g_free (dashes);
+			g_strfreev (items);
 
-                        return FALSE;
-                }
-        }
+			return FALSE;
+		}
+	}
 
 	g_strfreev (items);
 
-        *dashes_out = dashes;
-        *num_dashes_out = num_dashes;
+	g_assert (num_dashes % 2 == 0);
+
+	*dashes_out = dashes;
+	*num_dashes_out = num_dashes;
 
 	return TRUE;
 }
