Skip to content

Guard against nil proto config in loadConfig#148

Merged
pkwarren merged 1 commit into
bufbuild:mainfrom
ctcjab:fix-nil-proto-config
Jun 1, 2026
Merged

Guard against nil proto config in loadConfig#148
pkwarren merged 1 commit into
bufbuild:mainfrom
ctcjab:fix-nil-proto-config

Conversation

@ctcjab
Copy link
Copy Markdown
Contributor

@ctcjab ctcjab commented May 25, 2026

Summary

proto.GetProtoConfig() returns nil when the proto Gazelle language is not loaded alongside buf. This causes a nil pointer dereference panic in loadConfig at gazelle/buf/config.go:117.

This can happen when using aspect_gazelle_prebuilt (or any Gazelle binary) with buf enabled but proto not in the languages list.

Fix

Guard the proto.GetProtoConfig() return value with a nil check. When nil, log a message and skip the strip_import_prefix configuration.

Fixes #147

proto.GetProtoConfig() returns nil when the proto Gazelle language
is not loaded alongside buf. Guard the return value to prevent a
nil pointer dereference panic.

Fixes bufbuild#147
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 25, 2026

CLA assistant check
All committers have signed the CLA.

@pkwarren pkwarren changed the title fix(gazelle): guard against nil proto config in loadConfig Guard against nil proto config in loadConfig Jun 1, 2026
@pkwarren pkwarren merged commit 41375c4 into bufbuild:main Jun 1, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gazelle buf extension crashes with nil pointer dereference when proto language is not loaded

3 participants