Deleting rooms: Invalid pointers; safeguarrds
[citadel.git] / webcit / roomops.c
index edc09dec0eb1ca2ca74d5508a41471276217283b..09534742eeaae5ba09b01b4222c68ef64487d60d 100644 (file)
@@ -354,20 +354,30 @@ void ParseGoto(folder *room, StrBuf *Line)
  */
 void delete_room(void)
 {
-       StrBuf *Line;
+       StrBuf *Line = NewStrBuf();
+       const StrBuf *GoBstr;
        
-       serv_puts("KILL 1");
-       StrBuf_ServGetln(Line);
-       if (GetServerStatusMsg(Line, NULL, 1, 2) != 2) {
-               display_main_menu();
-       } else {
-               StrBuf *Buf;
-               
-               FlushRoomlist ();
-               Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
-               smart_goto(Buf);
-               FreeStrBuf(&Buf);
+       GoBstr = sbstr("go");
+
+       if (GoBstr != NULL)
+       {
+               if (gotoroom(GoBstr) == 200)
+               {
+                       serv_puts("KILL 1");
+                       StrBuf_ServGetln(Line);
+                       if (GetServerStatusMsg(Line, NULL, 1, 2) == 2) {
+                               StrBuf *Buf;
+                               
+                               FlushRoomlist ();
+                               Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
+                               smart_goto(Buf);
+                               FreeStrBuf(&Buf);
+                               FreeStrBuf(&Line);
+                               return;
+                       }
+               }
        }
+       display_main_menu();
        FreeStrBuf(&Line);
 }