diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs
index 60626b9..84f9d50 100644
--- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs
+++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs
@@ -55,11 +55,19 @@ public class SkipIntroController : ControllerBase
/// Episode ID to update timestamps for.
/// New timestamps Introduction/Credits start and end times.
/// New timestamps saved.
+ /// Given ID is not an Episode.
/// No content.
[Authorize(Policy = Policies.RequiresElevation)]
[HttpPost("Episode/{Id}/Timestamps")]
public ActionResult UpdateTimestamps([FromRoute] Guid id, [FromBody] TimeStamps timestamps)
{
+ // only update existing episodes
+ var rawItem = Plugin.Instance!.GetItem(id);
+ if (rawItem == null || rawItem is not Episode episode)
+ {
+ return NotFound();
+ }
+
if (timestamps?.Introduction.IntroEnd > 0.0)
{
var tr = new TimeRange(timestamps.Introduction.IntroStart, timestamps.Introduction.IntroEnd);
@@ -82,7 +90,8 @@ public class SkipIntroController : ControllerBase
/// Gets the timestamps for the provided episode.
///
/// Episode ID.
- /// Sucess.
+ /// Sucess.
+ /// Given ID is not an Episode.
/// Episode Timestamps.
[HttpGet("Episode/{Id}/Timestamps")]
[ActionName("UpdateTimestamps")]