Commit e8f34fb1 authored by Andrés G. Aragoneses's avatar Andrés G. Aragoneses

Mtp: prevent earlier the use of NULL as MtpDevice in AbstractTrackList

In order to track down the source of bgo#733883, it's better to
throw ArgumentNullException earlier at creation time than later
causing a NullReferenceException when the field is going to be
used.

(In order to check against NULL only once, this commit chains 2
constructors together.)
parent 32d0be4f
......@@ -57,13 +57,19 @@ namespace Mtp
protected AbstractTrackList (MtpDevice device)
{
if (device == null) {
throw new ArgumentNullException ("device");
}
this.device = device;
track_ids = new List<uint> ();
if (track_ids == null) {
track_ids = new List<uint> ();
}
}
internal AbstractTrackList (MtpDevice device, IntPtr tracks, uint count)
internal AbstractTrackList (MtpDevice device, IntPtr tracks, uint count) : this (device)
{
this.device = device;
this.saved = true;
this.track_ids = new List<uint> ();
......
Markdown is supported
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