[dconf] Fix error handling for missing *.d/locks/ dir



commit 1ec44d63e5560d00098954890661be9fb944ada6
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Oct 19 17:39:10 2011 -0400

    Fix error handling for missing *.d/locks/ dir
    
    We were incorrectly checking for NULL as a return value from Dir.open()
    when that function as bound as throwing an exception on error -- so
    catch the exception instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=662158

 bin/dconf-update.vala |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/bin/dconf-update.vala b/bin/dconf-update.vala
index 841fbfa..2446c16 100644
--- a/bin/dconf-update.vala
+++ b/bin/dconf-update.vala
@@ -42,9 +42,11 @@ unowned Gvdb.Item get_parent (Gvdb.HashTable table, string name) {
 }
 
 Gvdb.HashTable? read_locks_directory (string dirname) throws GLib.Error {
-	var dir = Dir.open (dirname);
+	Dir dir;
 
-	if (dir == null) {
+	try {
+		dir = Dir.open (dirname);
+	} catch {
 		return null;
 	}
 



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