version 0.3
[jMoule] / src / DonkeyCore.java
old mode 100755 (executable)
new mode 100644 (file)
index bd79353..c28066a
@@ -558,11 +558,26 @@ public class DonkeyCore extends Thread
                                        debug("FileInformation: ");\r
                                        id=new Long(readLong()); // id\r
                                        readLong(); // network\r
-                                       n=readInt();\r
-                                       readString();\r
-                                       fileInfo.add(readString());\r
-                                       for (i=0;i<n-2;i++)     debug(readString()); // names\r
-                                       //for (i=0;i<n;i++)     debug(readString()); // names\r
+                                       n=readInt();
+                                       if (n==0)
+                                       {
+                                               // no name, this should not happen...
+                                               fileInfo.add("N/A");
+                                       }
+                                       else if (n==1)
+                                       {
+                                               // no name but the ID string\r
+                                               fileInfo.add(readString());
+                                       }
+                                       else
+                                       {
+                                               // skip the ID
+                                               readString();
+                                               // and get the first name\r
+                                               fileInfo.add(readString());\r
+                                               for (i=0;i<n-2;i++)     debug(readString()); // names\r
+                                               //for (i=0;i<n;i++)     debug(readString()); // names
+                                       }\r
                                        for (i=0;i<16;i++) readByte(); // hash\r
                                        //readLong(); // size\r
                                        //readLong(); // downloaded\r