[anjuta] git: Fix criticals with local-only repositories



commit d76ff31550db9f9e28d0e4fc8cb529d44712f084
Author: Jens Georg <mail jensge org>
Date:   Sun Jan 2 20:18:11 2011 +0100

    git: Fix criticals with local-only repositories

 plugins/git/git-ref-command.c |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/plugins/git/git-ref-command.c b/plugins/git/git-ref-command.c
index 9fdc332..8e609d8 100644
--- a/plugins/git/git-ref-command.c
+++ b/plugins/git/git-ref-command.c
@@ -339,24 +339,28 @@ git_ref_command_start_automatic_monitor (AnjutaCommand *command)
 	                                                G_FILE_ATTRIBUTE_STANDARD_TYPE,
 	                                                0, NULL, NULL);
 
-	remotes_info = g_file_enumerator_next_file (remotes_enumerator, NULL, NULL);
-
-	while (remotes_info)
+	if (remotes_enumerator)
 	{
-		/* Monitor each remote folder for changes */
-		if (g_file_info_get_attribute_uint32 (remotes_info, 
-		                                      G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY)
+		remotes_info = g_file_enumerator_next_file (remotes_enumerator, NULL, NULL);
+
+		while (remotes_info)
 		{
-			current_remote_file = g_file_get_child (remotes_file,
-			                                        g_file_info_get_name (remotes_info));
+			/* Monitor each remote folder for changes */
+			if (g_file_info_get_attribute_uint32 (remotes_info,
+				                                  G_FILE_ATTRIBUTE_STANDARD_TYPE) == G_FILE_TYPE_DIRECTORY)
+			{
+				current_remote_file = g_file_get_child (remotes_file,
+				                                        g_file_info_get_name (remotes_info));
 
-			git_ref_command_add_file_monitor (self, current_remote_file);
-		}
+				git_ref_command_add_file_monitor (self, current_remote_file);
+			}
 
-		g_object_unref (remotes_info);
-		
-		remotes_info = g_file_enumerator_next_file (remotes_enumerator, NULL, 
-		                                            NULL);
+			g_object_unref (remotes_info);
+
+			remotes_info = g_file_enumerator_next_file (remotes_enumerator, NULL,
+			                                            NULL);
+		}
+		g_object_unref (remotes_enumerator);
 	}
 
 	g_free (working_directory);
@@ -365,8 +369,7 @@ git_ref_command_start_automatic_monitor (AnjutaCommand *command)
 	g_free (git_branches_path);
 	g_free (git_tags_path);
 	g_free (git_remotes_path);
-	g_object_unref (remotes_enumerator);
-	
+
 	return TRUE;
 }
 



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