Fix segmentation fault with tool capabilities (#5899)
authorShadowNinja <ShadowNinja@users.noreply.github.com>
Sat, 3 Jun 2017 21:59:17 +0000 (17:59 -0400)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Sat, 3 Jun 2017 21:59:17 +0000 (23:59 +0200)
src/game.cpp

index 765744b75b8e9dd0dfa6e2fde12e52315ff0c90d..aeb9e8f45a66545d78da77dc2669d34a90043125 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);