Files
compiler-explorer/static
Matt GodboltandClaude d0c16246d3 Fix null reference error in findConfig when URL parsing fails (#7763)
## Summary

Fixes `TypeError: Cannot read properties of undefined (reading
'content')` in `findConfig()` when URL parsing fails and no saved state
is available.

## Root Cause

This error occurs when:
1. `url.deserialiseState()` throws an exception due to
malformed/corrupted URLs
2. No saved state exists in localStorage
(`sessionThenLocalStorage.get('gl', null)` returns `null`)
3. Code attempts to access `config.content` when `config` is still
`undefined`

The error happens legitimately from truncated URLs, corrupted bookmarks,
or URL shortener issues.

## Changes

- Changed `if (!config.content || config.content.length === 0)` to use
optional chaining: `if (!config?.content || config.content?.length ===
0)`
- This gracefully handles the null/undefined case and falls back to
default config as intended

## Impact

- Maintains existing user experience (fallback to default config when
URL parsing fails)
- Prevents crash with 1430+ reported occurrences
- No behavioral changes for valid URLs

Fixes COMPILER-EXPLORER-DE3

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-06 14:28:56 -05:00
..
2025-05-21 13:53:05 -05:00
2025-05-19 06:51:21 -05:00
2025-02-26 02:07:09 +02:00
2025-02-26 02:07:09 +02:00
2025-02-26 02:07:09 +02:00
2024-10-25 12:19:04 +03:00
2025-04-24 12:10:37 -05:00
2025-04-24 12:10:37 -05:00
2025-04-24 18:41:55 -05:00