[js/webgpu] resolve codescan alert (#19343)

### Description
resolve codescan alert:
https://github.com/microsoft/onnxruntime/security/code-scanning/17687
This commit is contained in:
Yulong Wang 2024-01-30 21:06:21 -08:00 committed by GitHub
parent d73131cf0f
commit dd1f6ccc45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -705,13 +705,11 @@ export class WebGpuBackend {
captureBegin(): void { captureBegin(): void {
LOG_DEBUG('info', 'captureBegin'); LOG_DEBUG('info', 'captureBegin');
let sessionCommandList = this.capturedCommandList.get(this.currentSessionId!); if (!this.capturedCommandList.get(this.currentSessionId!)) {
let sessionPendingKernels = this.capturedPendingKernels.get(this.currentSessionId!); this.capturedCommandList.set(this.currentSessionId!, []);
if (!sessionCommandList) { }
sessionCommandList = []; if (!this.capturedPendingKernels.get(this.currentSessionId!)) {
this.capturedCommandList.set(this.currentSessionId!, sessionCommandList); this.capturedPendingKernels.set(this.currentSessionId!, []);
sessionPendingKernels = [];
this.capturedPendingKernels.set(this.currentSessionId!, sessionPendingKernels);
} }
// flush the left commands before we change the status. // flush the left commands before we change the status.
this.flush(); this.flush();