Author: toad
Date: 2007-11-19 22:57:09 +0000 (Mon, 19 Nov 2007)
New Revision: 15864

Modified:
   trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
Log:
Fix ClassCastException in add a bookmark

Modified: trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-11-19 22:55:34 UTC (rev 15863)
+++ trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java   
2007-11-19 22:57:09 UTC (rev 15864)
@@ -213,13 +213,14 @@

                                        form.addChild("br");
                                        if (("edit".equals(action) && bookmark 
instanceof BookmarkItem) || "addItem".equals(action)) {
-                                               BookmarkItem item = 
(BookmarkItem) bookmark;
+                                               BookmarkItem item = null;
+                                               if(bookmark != null) item = 
(BookmarkItem) bookmark;
                                                String key = 
(action.equals("edit") ? item.getKey() : "");
                                                form.addChild("label", "for", 
"key", (L10n.getString("BookmarkEditorToadlet.keyLabel") + ' '));
                                                form.addChild("input", new 
String[]{"type", "id", "name", "size", "value"}, new String []{"text", "key", 
"key", "50", key});
                                                form.addChild("br");
                                                form.addChild("label", "for", 
"hasAnActivelink", 
(L10n.getString("BookmarkEditorToadlet.hasAnActivelinkLabel") + ' '));
-                                               if(item.hasAnActivelink())
+                                               if(item != null && 
item.hasAnActivelink())
                                                        form.addChild("input", 
new String[]{"type", "id", "name", "checked" }, new String[]{"checkbox", 
"hasAnActivelink", "hasAnActivelink", String.valueOf(item.hasAnActivelink()) });
                                                else
                                                        form.addChild("input", 
new String[]{"type", "id", "name"}, new String[]{"checkbox", "hasAnActivelink", 
"hasAnActivelink" });


Reply via email to