We think it has something to do with NetworkTable.setClientMode() because when we remove that line it doesn’t crash but we are not able to retrieve the number.
Remove the setIPAddress line on the robot, and make sure on the client you set the IP address to the mDNS address of the robot - roborio-5940-FRC.local.
I was able to fix the problem. NetworkTable.setServerMode() is automatically done in the robot code which causes the code to crash if you call NetworkTable.setClientMode().
I removed NetwokTable.setClientMode() from the robot code and put it on the coprocessor instead. I also moved NetworkTable.setIpAddress() to the coprocessor.