From 6a9f35b353bc3737a8d58352ff31e94f385fa643 Mon Sep 17 00:00:00 2001 From: Sean Linsley Date: Fri, 12 Jul 2024 14:29:38 -0500 Subject: [PATCH] Fix parse error handling when statement line is missing (#567) --- logs/analyze.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/logs/analyze.go b/logs/analyze.go index 2473f18a1..8080ec82e 100644 --- a/logs/analyze.go +++ b/logs/analyze.go @@ -1284,11 +1284,13 @@ func classifyAndSetDetails(logLine state.LogLine, statementLine state.LogLine, d logLine.Classification = syntaxError.classification // The statement already has a LogSecretMarker, but we add another one so it's // redacted for both `statement_text` and `parsing_error` log filters. - statementLine.SecretMarkers = append(statementLine.SecretMarkers, state.LogSecretMarker{ - ByteStart: statementLine.SecretMarkers[0].ByteStart, - ByteEnd: statementLine.SecretMarkers[0].ByteEnd, - Kind: state.ParsingErrorLogSecret, - }) + if len(statementLine.SecretMarkers) > 0 { + statementLine.SecretMarkers = append(statementLine.SecretMarkers, state.LogSecretMarker{ + ByteStart: statementLine.SecretMarkers[0].ByteStart, + ByteEnd: statementLine.SecretMarkers[0].ByteEnd, + Kind: state.ParsingErrorLogSecret, + }) + } return logLine, statementLine, detailLine, contextLine, hintLine, samples } }