use isdbnull instead of cast

This commit is contained in:
Luke Pulverenti 2013-05-09 10:37:20 -04:00
parent d7cc4738e6
commit 1d826741f3

View File

@ -283,11 +283,9 @@ namespace MediaBrowser.Server.Implementations.Sqlite
userdata.IsFavorite = reader.GetBoolean(3); userdata.IsFavorite = reader.GetBoolean(3);
userdata.Played = reader.GetBoolean(4); userdata.Played = reader.GetBoolean(4);
var ticks = (long?) reader.GetValue(5); if (!reader.IsDBNull(5))
if (ticks.HasValue)
{ {
userdata.LastPlayedDate = new DateTime(ticks.Value); userdata.LastPlayedDate = new DateTime(reader.GetInt64(5));
} }
} }
} }