aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/util.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/hardinfo2/util.c b/hardinfo2/util.c
index bf5926f0..da3a338b 100644
--- a/hardinfo2/util.c
+++ b/hardinfo2/util.c
@@ -475,16 +475,15 @@ static GSList *modules_load(gchar **module_list)
dir = g_dir_open(filename, 0, NULL);
g_free(filename);
- if (!dir) {
- return NULL;
- }
-
- while ((filename = (gchar*)g_dir_read_name(dir))) {
- if (module_in_module_list(filename, module_list)) {
- if ((module = module_load(filename))) {
- modules = g_slist_append(modules, module);
+ if (dir) {
+ while ((filename = (gchar*)g_dir_read_name(dir))) {
+ if (module_in_module_list(filename, module_list) &&
+ ((module = module_load(filename)))) {
+ modules = g_slist_append(modules, module);
}
}
+
+ g_dir_close(dir);
}
if (g_slist_length(modules) == 0) {