Fixed NPE in OioDatagramWorker.writeNow()

This commit is contained in:
Trustin Lee 2009-06-12 01:52:02 +00:00
parent 01d8de26cf
commit ee3ae043dc

View File

@ -117,7 +117,11 @@ class OioDatagramWorker implements Runnable {
ChannelBuffer a = (ChannelBuffer) message;
byte[] b = new byte[a.readableBytes()];
a.getBytes(0, b);
channel.socket.send(new DatagramPacket(b, b.length, remoteAddress));
DatagramPacket packet = new DatagramPacket(b, b.length);
if (remoteAddress != null) {
packet.setSocketAddress(remoteAddress);
}
channel.socket.send(packet);
fireWriteComplete(channel, b.length);
future.setSuccess();
} catch (Throwable t) {