There’s been a bug in Terraria for the last patch or two that causes some users to crash upon right-clicking any stacked item in their inventory or a chest. The game will crash and .Net will pop up an error starting with:
System.NullReferenceException: Object reference not set to an instance of an object.
What it’s trying to do is make a stack/unstack sound and when it can’t, the game crashes. This is usually due to your audio drivers needing to be reinstalled. Simply google the make/model of your motherboard and download the sound drivers. If you’re using an add-on sound card, then grab the drivers for that, install them and give it another go. If you’re sound’s working by default then it’s most likely the case that you’re using the default Windows drivers.
Source: Worked for me and numerous other people. Hope this helps some people having a bad experience with this fun game.