Commit b7c7f0fb authored by Adrien Plazas's avatar Adrien Plazas
Browse files

Catch or declare forgotten errors

This fixes some compile time warnings.
parent 44e1c3dc
......@@ -5,11 +5,16 @@ private class Games.DatabaseUriIterator : Object, UriIterator {
SELECT uri FROM game_resources;
""";
private Sqlite.Statement statement;
private Sqlite.Statement? statement;
private Uri? uri;
internal DatabaseUriIterator (Sqlite.Database database) {
statement = Database.prepare (database, SELECT_GAME_RESOURCE_QUERY);
try {
statement = Database.prepare (database, SELECT_GAME_RESOURCE_QUERY);
}
catch (Error e) {
debug (e.message);
}
}
public new Uri? get () {
......@@ -17,6 +22,9 @@ private class Games.DatabaseUriIterator : Object, UriIterator {
}
public bool next () {
if (statement == null)
return false;
if (statement.step () != Sqlite.ROW)
return false;
......
......@@ -37,7 +37,7 @@ private class Games.Database : Object {
throw new DatabaseError.EXECUTION_FAILED ("Execution failed.");
}
public bool has_uri (Uri uri) {
public bool has_uri (Uri uri) throws Error {
var statement = prepare (database, HAS_URI_QUERY);
bind_text (statement, "$URI", uri.to_string ());
......
......@@ -313,7 +313,14 @@ public class Games.RetroRunner : Object, Runner {
if (!is_initialized)
return;
core.set_current_media (media_set.selected_media_number);
try {
core.set_current_media (media_set.selected_media_number);
}
catch (Error e) {
debug (e.message);
return;
}
var media_number = media_set.selected_media_number;
......@@ -331,9 +338,14 @@ public class Games.RetroRunner : Object, Runner {
if (uris.length == 0)
return;
var uri = uris[0];
try {
core.set_current_media (media_set.selected_media_number);
}
catch (Error e) {
debug (e.message);
core.set_current_media (media_set.selected_media_number);
return;
}
try {
save_media_data ();
......
......@@ -279,8 +279,14 @@ public class Games.Application : Gtk.Application {
}
private async void add_cached_uri (Uri uri) {
if (database != null)
database.add_uri (uri);
try {
if (database != null)
database.add_uri (uri);
}
catch (Error e) {
debug (e.message);
}
yield game_collection.add_uri (uri);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment