UVoiceChannel::AddVoicePacket crashes with LogNet set to All on client

In the *Engine.ini file add:




The code will crash on the client when using Voice in game on a server because the Connection->PlayerId is NULL. I looked throughout the engine code and this only gets set on the server and never on the client. My only workaround right now is to set it on the client before the AddVoicePacket call occurs.

The place where the crash occurs:

void UVoiceChannel::AddVoicePacket(TSharedPtr<FVoicePacket> VoicePacket)
	if (VoicePacket.IsValid())

		UE_LOG(LogNet, Log, TEXT("AddVoicePacket: %s [%s] to=%s from=%s"),

Right here:


These are fine:


Hi ,

I tried to reproduce this, but was not able to see a crash. Would you be able to provide some additional information about this issue?

  • What version of the Engine are you using?
  • Are you using the binary version of the Engine installed by the Launcher, or did you build the Engine from source code?
  • After adding the .ini settings you listed above, do you do anything specific to set this up?
  • Are you testing in PIE, Standalone, or have you packaged your game? How many clients were you testing with?
  • Any additional information you can think of would be very helpful.

Version: 4.6.1 Engine Source (no mods to release branch)
Only specific thing is to log in to a dedicated server, crash occurs on client.

Game is packaged as development and I’ve even tried it with DebugGame. Occurs with one or more clients.

I can’t think of anything else in addition to this. Did you set your breakpoint in this function to ensure that you are actually entering this function? You need to be party to a session through a dedicated server and have VoIP enabled before the client will try to send any voice packets.

Hi ,

You are correct, the UNetConnection::PlayerId isn’t valid on the client. The only reason I think this may not be crashing for us is that we might not run with LogNet set to VeryVerbose very often, so the NULL parameter is getting optimized out. Could you by be running at that logging level?

A quick fix is to check for NULL there in the UE_LOG macro. I’ll run this by some folks locally to make sure this checks out, but this is my suspicion at the moment. If this is what is happening, we can fix this locally, thanks for pointing this out :slight_smile:

Yes, sorry that I did not explicitly indicate that in this question. My first question clearly indicated that but my question was lost and I had to retype it all. But the ini file above shows the All setting for the UE_LOG for LogNet which is the same as VeryVerbose. It made it hard for me to do my testing with this bug.

Hi ,

We’ve added a NULL check in the engine to fix this in the short term. The server currently doesn’t communicate his own player id back to the client.

We’re thinking about ways to improve this going forward (maybe have the server send it in the case where it can), but for now, we’re going with the NULL check, which should fix your crash too :slight_smile:

OK, great, thanks so much. I’ll continue reporting / fixing bugs as I find them. I’m really hoping someone can address the gameini issue I was having in the other bug report, more than two weeks and still no response.