[gnome-games] utils: Check null values
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] utils: Check null values
- Date: Fri, 28 Apr 2017 06:52:53 +0000 (UTC)
commit 0aee4701f4564aba41fe9a5852da9ddc9a06264a
Author: Mathieu Bridon <bochecha daitauha fr>
Date: Thu Apr 27 23:25:14 2017 +0200
utils: Check null values
These two functions can return null in some cases. Passing null to the
FileUtils.test function leads to lots of critical messages in the
console.
https://bugzilla.gnome.org/show_bug.cgi?id=781864
src/utils/local-cover.vala | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/utils/local-cover.vala b/src/utils/local-cover.vala
index daf6f6c..4ad02a9 100644
--- a/src/utils/local-cover.vala
+++ b/src/utils/local-cover.vala
@@ -36,11 +36,11 @@ public class Games.LocalCover : Object, Cover {
private string? get_cover_path () throws Error {
var cover_path = get_sibbling_cover_path ();
- if (FileUtils.test (cover_path, FileTest.EXISTS))
+ if (cover_path != null && FileUtils.test (cover_path, FileTest.EXISTS))
return cover_path;
cover_path = get_directory_cover_path ();
- if (FileUtils.test (cover_path, FileTest.EXISTS))
+ if (cover_path != null && FileUtils.test (cover_path, FileTest.EXISTS))
return cover_path;
return null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]