fix(discovery): add null-safe validation for v3 array entries

Filter out null, undefined, or malformed entries in installed_plugins.json
before accessing properties. Prevents fatal crash on corrupted data.

Addresses cubic-dev-ai review feedback.
This commit is contained in:
Robin Mordasiewicz
2026-03-14 05:35:12 +00:00
parent bc0ba843ac
commit 0d1d405a72
2 changed files with 20 additions and 5 deletions
+4 -1
View File
@@ -19452,9 +19452,12 @@ function v3EntryToInstallation(entry) {
gitCommitSha: entry.gitCommitSha
};
}
function isValidV3Entry(entry) {
return entry != null && typeof entry === "object" && typeof entry.name === "string" && typeof entry.marketplace === "string" && typeof entry.installPath === "string";
}
function extractPluginEntries(db) {
if (Array.isArray(db)) {
return db.map((entry) => [
return db.filter(isValidV3Entry).map((entry) => [
`${entry.name}@${entry.marketplace}`,
v3EntryToInstallation(entry)
]);