[anjuta] libanjuta: Better fix for previous crash



commit 1dc4f19258465f453af49383ecbaf107add1d82c
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sat Jun 18 15:53:58 2011 +0200

    libanjuta: Better fix for previous crash

 libanjuta/anjuta-token-file.c   |    8 ++++----
 libanjuta/anjuta-token-stream.c |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/libanjuta/anjuta-token-file.c b/libanjuta/anjuta-token-file.c
index fd4c28c..49ef23b 100644
--- a/libanjuta/anjuta-token-file.c
+++ b/libanjuta/anjuta-token-file.c
@@ -110,13 +110,13 @@ anjuta_token_file_load (AnjutaTokenFile *file, GError **error)
 
 	anjuta_token_file_unload (file);
 	
-	file->save = anjuta_token_new_static (ANJUTA_TOKEN_FILE,  NULL);
-	file->content = anjuta_token_new_static (ANJUTA_TOKEN_FILE,  NULL);
-
 	if (g_file_load_contents (file->file, NULL, &content, &length, NULL, error))
 	{
 		AnjutaToken *token;
-	
+
+		file->save = anjuta_token_new_static (ANJUTA_TOKEN_FILE,  NULL);
+		file->content = anjuta_token_new_static (ANJUTA_TOKEN_FILE,  NULL);
+		
 		token =	anjuta_token_new_string_len (ANJUTA_TOKEN_FILE, content, length);
 		anjuta_token_prepend_child (file->save, token);
 		
diff --git a/libanjuta/anjuta-token-stream.c b/libanjuta/anjuta-token-stream.c
index 60e0ee5..f780c03 100644
--- a/libanjuta/anjuta-token-stream.c
+++ b/libanjuta/anjuta-token-stream.c
@@ -326,7 +326,7 @@ anjuta_token_stream_push (AnjutaTokenStream *parent, AnjutaToken *root, AnjutaTo
 	child->parent = parent;
 	child->token = content;
 	child->start = child->token;
-	child->last = anjuta_token_last (content);
+	child->last = content == NULL ? NULL : anjuta_token_last (content);
 
 	child->root = root == NULL ? anjuta_token_new_static (ANJUTA_TOKEN_FILE, NULL) : root;
 	if (file == NULL)



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