Skip to content

Commit

Permalink
fix: prevent panic on partial append failures
Browse files Browse the repository at this point in the history
During partial append failures, the error field was incorrectly accessed
from a nil err variable instead of the result struct, causing a nil
pointer dereference panic.

Change err.Error() to res[idx].Error to properly handle error messages
in partial failure cases.
  • Loading branch information
kakao-mark-yun authored and ijsong committed Jan 31, 2025
1 parent ddbd14f commit b6fb11e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/varlog/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ RETRY:

for idx := 0; idx < len(res); idx++ {
if len(res[idx].Error) > 0 {
if strings.Contains(err.Error(), "sealed") {
if strings.Contains(res[idx].Error, "sealed") {
result.Err = fmt.Errorf("append: %s: %w", res[idx].Error, verrors.ErrSealed)
} else {
result.Err = fmt.Errorf("append: %s", res[idx].Error)
Expand Down

0 comments on commit b6fb11e

Please sign in to comment.