[gtk+/wip/otte/tokenizer: 26/42] inspector: Move errors on EOF token to last token



commit 7cd1f26b653422c28dd8db0af12979a6ce5d7b31
Author: Benjamin Otte <otte redhat com>
Date:   Thu Mar 17 21:59:26 2016 +0100

    inspector: Move errors on EOF token to last token
    
    That's wrong, but it makes sure we don't lose any error messages.

 gtk/inspector/css-editor.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c
index a8ca34f..3b3210a 100644
--- a/gtk/inspector/css-editor.c
+++ b/gtk/inspector/css-editor.c
@@ -180,15 +180,18 @@ static void
 gtk_css_chunk_token_source_error (GtkCssTokenSource *source,
                                   const GError      *error)
 {
-  GtkCssChunkTokenSource *chunk = (GtkCssChunkTokenSource *) source;
+  GtkCssChunkTokenSource *chunk_source = (GtkCssChunkTokenSource *) source;
+  GtkCssChunk *chunk;
 
-  if (chunk->chunk == NULL)
-    return;
+  if (chunk_source->chunk != NULL)
+    chunk = chunk_source->chunk;
+  else
+    chunk = gtk_css_rb_tree_get_last (chunk_source->tree);
 
-  if (chunk->chunk->error)
+  if (chunk->error)
     g_warning ("figure out what to do with two errors on the same token");
   else
-    chunk->chunk->error = g_error_copy (error);
+    chunk->error = g_error_copy (error);
 }
 
 const GtkCssTokenSourceClass GTK_CSS_CHUNK_TOKEN_SOURCE = {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]