Skip to content

Commit 3afc047

Browse files
authored
Fix bug in url params (#320)
If the member of lowerCaseParams is not presented, it is undefined rather than null. Fixed partial of #318
1 parent b1568e9 commit 3afc047

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

common/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ export function getUrlParams() {
280280

281281
// Get 'numRuns' param to run inference multiple times
282282
let numRuns = lowerCaseParams['numruns'];
283-
numRuns = numRuns === null ? 1 : parseInt(numRuns);
283+
numRuns = numRuns ? parseInt(numRuns) : 1;
284284
if (numRuns < 1) {
285285
addAlert(`Ignore the url param: 'numRuns', its value must be >= 1.`);
286286
numRuns = 1;
@@ -298,7 +298,7 @@ export function getUrlParams() {
298298

299299
// Get 'numThreads' param to set WebNN's 'numThreads' option
300300
let numThreads = lowerCaseParams['numthreads'];
301-
if (numThreads != null) {
301+
if (numThreads) {
302302
numThreads = parseInt(numThreads);
303303
if (!Number.isInteger(numThreads) || numThreads < 0) {
304304
addAlert(`Ignore the url param: 'numThreads', its value must be ` +

0 commit comments

Comments
 (0)