[gnome-games] retro: Check existence of module file
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] retro: Check existence of module file
- Date: Mon, 20 Mar 2017 13:36:18 +0000 (UTC)
commit 431a74ef52c54682c472a0d8a72630825f9904ac
Author: theawless <theawless gmail com>
Date: Tue Mar 14 20:43:33 2017 +0530
retro: Check existence of module file
Retro.CoreDescriptor.get_module_file() returns null when module file is
not found. Null check module file before getting its path for Retro.Core.
https://bugzilla.gnome.org/show_bug.cgi?id=779924
src/retro/retro-core-source.vala | 2 ++
src/retro/retro-runner.vala | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/retro/retro-core-source.vala b/src/retro/retro-core-source.vala
index 1828c00..946207d 100644
--- a/src/retro/retro-core-source.vala
+++ b/src/retro/retro-core-source.vala
@@ -21,6 +21,8 @@ public class Games.RetroCoreSource : Object {
ensure_module_is_found ();
var module_file = core_descriptor.get_module_file ();
+ if (module_file == null)
+ throw new RetroError.MODULE_NOT_FOUND (_("No module found for platform “%s” and MIME
types [ “%s” ]."), platform, string.joinv (_("”, “"), mime_types));
return module_file.get_path ();
}
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 9d31c34..b749de2 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -259,6 +259,9 @@ public class Games.RetroRunner : Object, Runner {
string module_path;
if (core_descriptor != null) {
var module_file = core_descriptor.get_module_file ();
+ if (module_file == null)
+ throw new RetroError.MODULE_NOT_FOUND (_("No module found for “%s”."),
core_descriptor.get_name ());
+
module_path = module_file.get_path ();
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]