Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit fadaaeb

Browse files
committed
#128. Check Cancellation Token hasn't expired before creating a new file.
1 parent e6e6e3d commit fadaaeb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/MMALSharp/MMALCamera.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ public async Task TakePictureTimeout(IFileStreamCaptureHandler handler, MMALEnco
252252
{
253253
await this.ProcessAsync(this.Camera.StillPort).ConfigureAwait(false);
254254

255-
handler.NewFile();
255+
if (!cancellationToken.IsCancellationRequested)
256+
{
257+
handler.NewFile();
258+
}
256259
}
257260
}
258261
}
@@ -314,7 +317,10 @@ public async Task TakePictureTimelapse(IFileStreamCaptureHandler handler, MMALEn
314317

315318
await this.ProcessAsync(this.Camera.StillPort).ConfigureAwait(false);
316319

317-
handler.NewFile();
320+
if (!timelapse.CancellationToken.IsCancellationRequested)
321+
{
322+
handler.NewFile();
323+
}
318324
}
319325
}
320326
}

0 commit comments

Comments
 (0)