From 0a4ca49a498839cf0cf27fe15f6a939ac723ad20 Mon Sep 17 00:00:00 2001 From: RebeccaNod1 Date: Thu, 2 Oct 2025 11:24:53 -0500 Subject: [PATCH] fix: Improve JSON parsing robustness in Update_Checker - Add error handling for malformed release notes - Parse critical fields first (tag_name, html_url) - Gracefully handle JSON parsing failures in release body - Add verbose logging for debugging API responses This fixes parsing errors when GitHub releases contain special characters. --- Update_Checker.lsl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Update_Checker.lsl b/Update_Checker.lsl index b71b751..7ea2e58 100644 --- a/Update_Checker.lsl +++ b/Update_Checker.lsl @@ -287,20 +287,28 @@ default { updateCheckInProgress = FALSE; if (status == 200) { - // Parse GitHub release JSON + // Parse GitHub release JSON - with robust error handling string latestVersion = llJsonGetValue(body, ["tag_name"]); - string releaseNotes = llJsonGetValue(body, ["body"]); string htmlUrl = llJsonGetValue(body, ["html_url"]); string publishedAt = llJsonGetValue(body, ["published_at"]); if (latestVersion == JSON_INVALID) { llOwnerSay("❌ Could not parse GitHub API response"); if (VERBOSE_LOGGING) { - llOwnerSay("🔍 Response: " + llGetSubString(body, 0, 100) + "..."); + llOwnerSay("🔍 Response preview: " + llGetSubString(body, 0, 200) + "..."); } return; } + // Parse release notes with error handling + string releaseNotes = llJsonGetValue(body, ["body"]); + if (releaseNotes == JSON_INVALID) { + releaseNotes = "Release notes unavailable"; + if (VERBOSE_LOGGING) { + llOwnerSay("⚠️ Could not parse release notes - may contain special characters"); + } + } + llOwnerSay("=== 🔍 UPDATE CHECK RESULTS ==="); llOwnerSay("📊 Current Version: v" + CURRENT_VERSION); llOwnerSay("✨ Latest GitHub Release: " + latestVersion);