diff --git a/xtrn/ddfilelister/ddfilelister.js b/xtrn/ddfilelister/ddfilelister.js index f452f16834b4aa4db22f2a69c6a29cf9ef2721de..bfda9f42f2eaae636fde4ada5a1f6235bda625ae 100644 --- a/xtrn/ddfilelister/ddfilelister.js +++ b/xtrn/ddfilelister/ddfilelister.js @@ -96,6 +96,8 @@ * 2023-11-11 Eric Oulashin Version 2.15a * On start, if console.aborted is true (due to the user pressing Ctrl-C, etc.), * then return -1 to stop a file scan in progress. + * 2024-02-02 Eric Oulashin Version 2.15b + * More checks for pFileList[pIdx] and the 'desc' property when getting the description */ "use strict"; @@ -140,8 +142,8 @@ require("attr_conv.js", "convertAttrsToSyncPerSysCfg"); // Lister version information -var LISTER_VERSION = "2.15a"; -var LISTER_DATE = "2023-11-11"; +var LISTER_VERSION = "2.15b"; +var LISTER_DATE = "2024-02-02"; /////////////////////////////////////////////////////////////////////////////// @@ -4975,7 +4977,9 @@ function numFileInfoLines(pFileList) // pFormatInfo: An object containing format information returned by getTraditionalFileInfoFormatInfo() function getFileInfoLineArrayForTraditionalUI(pFileList, pIdx, pFormatInfo) { - if (!Array.isArray(pFileList) || typeof(pIdx) !== "number" || pIdx < 0 || pIdx > pFileList.length) + if (!Array.isArray(pFileList) || typeof(pIdx) !== "number" || pIdx < 0 || pIdx >= pFileList.length) + return []; + if (pFileList[pIdx] == undefined) return []; var userExtDescEnabled = ((user.settings & USER_EXTDESC) == USER_EXTDESC); @@ -4983,7 +4987,10 @@ function getFileInfoLineArrayForTraditionalUI(pFileList, pIdx, pFormatInfo) if (userExtDescEnabled) descLines = getExtdFileDescArray(pFileList, pIdx); else - descLines = [ pFileList[pIdx].desc.replace(/\r$/, "").replace(/\n$/, "").replace(/\r\n$/, "") ]; + { + if (pFileList[pIdx].hasOwnProperty("desc") && typeof(pFileList[pIdx].desc) === "string") + descLines = [ pFileList[pIdx].desc.replace(/\r$/, "").replace(/\n$/, "").replace(/\r\n$/, "") ]; + } if (descLines.length == 0) descLines.push(""); @@ -5026,7 +5033,9 @@ function getTraditionalFileInfoFormatInfo() // if not available, the array will containin the non-extended description. function getExtdFileDescArray(pFileList, pIdx) { - if (!Array.isArray(pFileList) || typeof(pIdx) !== "number" || pIdx < 0 || pIdx > pFileList.length) + if (!Array.isArray(pFileList) || typeof(pIdx) !== "number" || pIdx < 0 || pIdx >= pFileList.length) + return []; + if (pFileList[pIdx] == undefined) return []; var extdDesc = ""; @@ -5040,7 +5049,10 @@ function getExtdFileDescArray(pFileList, pIdx) extdDesc = fileMetadata.extdesc; } if (extdDesc.length == 0) - extdDesc = pFileList[pIdx].desc; + { + if (pFileList[pIdx].hasOwnProperty("desc") && typeof(pFileList[pIdx].desc) === "string") + extdDesc = pFileList[pIdx].desc; + } var descLines = lfexpand(extdDesc).split("\r\n"); // Splitting as above can result in an extra empty last line if (descLines[descLines.length-1].length == 0) diff --git a/xtrn/ddfilelister/readme.txt b/xtrn/ddfilelister/readme.txt index 6cc23c41c8e6aeef23a4bc8f6269fdccbb6054c5..c40cc773d67063966a22ef05c6cf384e5592d667 100644 --- a/xtrn/ddfilelister/readme.txt +++ b/xtrn/ddfilelister/readme.txt @@ -1,6 +1,6 @@ Digital Distortion File Lister - Version 2.15a - Release date: 2023-11-11 + Version 2.15b + Release date: 2024-02-02 by diff --git a/xtrn/ddfilelister/revision_history.txt b/xtrn/ddfilelister/revision_history.txt index 90e3097546a249d6c78ab53695a2c1d2e059eddf..7fd4d632dae982da487fe40b3ef006ce07939349 100644 --- a/xtrn/ddfilelister/revision_history.txt +++ b/xtrn/ddfilelister/revision_history.txt @@ -5,6 +5,8 @@ Revision History (change log) ============================= Version Date Description ------- ---- ----------- +2.15b 2024-02-02 Code change/fix: More checks for pFileList[pIdx] and the + 'desc' property when getting the description 2.15a 2023-11-11 On start, if console.aborted is true (due to the user pressing Ctrl-C, etc.), then return -1 to stop a file scan in progress.