Fix segmentation fault with tool capabilities (#5899)
authorShadowNinja <ShadowNinja@users.noreply.github.com>
Sat, 3 Jun 2017 21:59:17 +0000 (17:59 -0400)
committerSmallJoker <mk939@ymail.com>
Sun, 3 Jun 2018 15:31:59 +0000 (17:31 +0200)
src/game.cpp

index ff473e022922541b32164cc744184855a0cef39b..75d1f7cc8b84c5de29783f64dba44a7f1fa5376e 100644 (file)
@@ -3597,7 +3597,7 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
        } else if (pointed.type == POINTEDTHING_NODE) {
                ToolCapabilities playeritem_toolcap =
                                playeritem.getToolCapabilities(itemdef_manager);
-               if (playeritem.name.empty()) {
+               if (playeritem.name.empty() && hand_def.tool_capabilities != NULL) {
                        playeritem_toolcap = *hand_def.tool_capabilities;
                }
                handlePointingAtNode(pointed, playeritem_def, playeritem_toolcap, dtime);