Technicolour/Trakt-for-Mediaportal — Issue #47: Trakt AnimePlugin issues when Episode is not yet in AniDB database and is played from the admin screen
Author: maxpiva
Created: 2011-11-01 06:16:18+00:00
State: open

Exception :System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at TraktPlugin.TraktHandlers.MyAnime.CreateScrobbleData(FileLocal episode)
at TraktPlugin.TraktHandlers.MyAnime.b__11(Object stateInfo)
at System.Threading._TimerCallback.TimerCallback_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._TimerCallback.PerformTimerCallback(Object state)

Possible solution:

Change line 647 @ MyAnime from

if (!GetTVDBEpisodeInfo(episode.AnimeEpisodes[0], out seriesid, out seasonidx, out episodeidx)) return null;

to

if ((episode.AnimeEpisodes==null) || (!GetTVDBEpisodeInfo(episode.AnimeEpisodes[0], out seriesid, out seasonidx, out episodeidx))) return null;