Skip to content

avoid NPE - #4

Merged
gaudenz merged 1 commit into
cloudscale-ch:mainfrom
m-studer:main
Oct 29, 2026
Merged

gaudenz merged 1 commit into
cloudscale-ch:mainfrom
m-studer:main

Conversation

@m-studer

Copy link
Copy Markdown
Contributor

When a server fails to provision, the server object will be empty. therefore, the call to server.Name will throw a null nil pointer

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x977036]

goroutine 42235 [running]:
github.com/cloudscale-ch/fleeting-plugin-cloudscale.(*InstanceGroup).Increase.func1.1({0xc000038990?, 0x0?})
	.../provider.go:335 +0x156
created by github.com/cloudscale-ch/fleeting-plugin-cloudscale.(*InstanceGroup).Increase.func1 in goroutine 42233
	.../provider.go:323 +0x78

by using the uuid which will not be nil we can avoid this issue.

@gaudenz gaudenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. The code looks good, but it would be nice to copy the explanation in the PR description into the git commit so it's preserved in the git history. Please also rebase onto the current main branch, this will make the workflows pass.

When a server fails to provision, the server object will be empty.
Therefore, the call to server.Name will throw a nil pointer panic:

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x977036]

    goroutine 42235 [running]:
    github.com/cloudscale-ch/fleeting-plugin-cloudscale.(*InstanceGroup).Increase.func1.1({0xc000038990?, 0x0?})
        .../provider.go:335 +0x156
    created by github.com/cloudscale-ch/fleeting-plugin-cloudscale.(*InstanceGroup).Increase.func1 in goroutine 42233
        .../provider.go:323 +0x78

By using the uuid, which will not be nil, we can avoid this issue.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@m-studer

Copy link
Copy Markdown
Contributor Author

done. LLM was used for the branch rename and fork rebase.

@m-studer
m-studer requested a review from gaudenz October 28, 2026 08:15
@gaudenz
gaudenz merged commit a115410 into cloudscale-ch:main Oct 29, 2026
3 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.

2 participants