diff rep/REPCommandPacker.java @ 385:1fca50ce3508

first-working-version
author one@firefly.cr.ie.u-ryukyu.ac.jp
date Mon, 10 Nov 2008 22:18:14 +0900
parents 4b87f89b3afd
children f8916a96a373
line wrap: on
line diff
--- a/rep/REPCommandPacker.java	Mon Nov 10 22:16:37 2008 +0900
+++ b/rep/REPCommandPacker.java	Mon Nov 10 22:18:14 2008 +0900
@@ -41,7 +41,9 @@
 	 * @see rep.REPPack#packUConv(rep.REPCommand)
 	 */
 	public ByteBuffer packUConv(REPCommand command){
-    	ByteBuffer buffer = ByteBuffer.allocateDirect(HEADER_SIZE+(command.string.length()*CHARSIZE));
+		int size = 0;
+		if (command.string!=null) size = command.string.length()*CHARSIZE;
+    	ByteBuffer buffer = ByteBuffer.allocateDirect(HEADER_SIZE+size);
     	buffer.clear();  // position = 0 
     	buffer.putInt(command.cmd.id);
     	buffer.putInt(command.sid);