Merge pull request #326 from realffqq/dev
Some checks are pending
Publish Documentation / build (push) Waiting to run
Build (Linux, x86_64) / build-linux (push) Waiting to run
Build (Linux, x86_64) / build-linux-debug (push) Waiting to run
Clang Format / clang-format (push) Waiting to run

fix: add null check to renderItemInHand
This commit is contained in:
Tropical 2026-03-27 19:49:37 -05:00 committed by GitHub
commit da7cbcb4b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -671,6 +671,11 @@ void GameRenderer::setupCamera(float a, int eye) {
void GameRenderer::renderItemInHand(float a, int eye) {
if (cameraFlip > 0) return;
// 4jcraft: this function sometimes causes a segfault (was hell to catch
// this in gdb) because of itemInHandRenderer not being initialized so let's
// add a nullcheck
if (itemInHandRenderer == nullptr) return;
// 4J-JEV: I'm fairly confident this method would crash if the cameratarget
// isnt a local player anyway, but oh well.
std::shared_ptr<LocalPlayer> localplayer =