[rygel] core: Prevent crash in ImportResource
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Prevent crash in ImportResource
- Date: Wed, 13 Apr 2011 12:42:03 +0000 (UTC)
commit 91dad9f3e346f3b7049c341df969707d51e5a519
Author: Jens Georg <mail jensge org>
Date: Wed Apr 13 14:55:18 2011 +0300
core: Prevent crash in ImportResource
Throw error when required input arguments are missing.
src/rygel/rygel-import-resource.vala | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/rygel/rygel-import-resource.vala b/src/rygel/rygel-import-resource.vala
index 669b601..6e57e38 100644
--- a/src/rygel/rygel-import-resource.vala
+++ b/src/rygel/rygel-import-resource.vala
@@ -100,10 +100,16 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
typeof (string),
out this.destination_uri);
- // Set action return arguments
- this.action.set ("TransferID", typeof (uint32), this.transfer_id);
-
try {
+ if (this.source_uri == null || this.destination_uri == null) {
+ throw new ContentDirectoryError.INVALID_ARGS
+ ("Must provide source " +
+ "and destination URIs");
+ }
+
+ // Set action return arguments
+ this.action.set ("TransferID", typeof (uint32), this.transfer_id);
+
this.item = yield this.fetch_item ();
} catch (Error error) {
warning (_("Failed to get original URI for '%s': %s"),
@@ -159,7 +165,6 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
this.http_server);
var media_object = yield this.root_container.find_object (uri.item_id,
null);
-
string msg = null;
if (media_object == null || !(media_object is MediaItem)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]