From: Art Cancro Date: Wed, 27 Jul 2011 20:35:02 +0000 (-0400) Subject: Worked around issue where gotoroom() is called with WC->CurRoom.name and the contents... X-Git-Tag: v8.11~539 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=7cab38e6faabd64d969eb3836c52869cae1bfd22 Worked around issue where gotoroom() is called with WC->CurRoom.name and the contents of this pointer then become invalid due to room change --- diff --git a/webcit/roomops.c b/webcit/roomops.c index 3d1e3a12c..b93a4910d 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -186,18 +186,30 @@ long gotoroom(const StrBuf *gname) StrBuf *Buf; static long ls = (-1L); long err = 0; + int room_name_supplied = 0; + int is_baseroom = 0; /* store ungoto information */ - if (StrLength(gname) > 0) + if (StrLength(gname) > 0) { + room_name_supplied = 1; + } + if (room_name_supplied) { strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name)); + if (!strcasecmp(ChrPtr(gname), "_BASEROOM_")) { + is_baseroom = 1; + } + } WCC->uglsn = ls; Buf = NewStrBuf(); /* move to the new room */ - if (StrLength(gname) > 0) + if (room_name_supplied) { serv_printf("GOTO %s", ChrPtr(gname)); - else /* or just refresh the current state... */ + } + else { + /* or just refresh the current state... */ serv_printf("GOTO 00000000000000000000"); + } StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, &err) != 2) { serv_puts("GOTO _BASEROOM_"); @@ -215,11 +227,11 @@ long gotoroom(const StrBuf *gname) FlushFolder(&WCC->CurRoom); ParseGoto(&WCC->CurRoom, Buf); - if (StrLength(gname) > 0) - { + if (room_name_supplied) { remove_march(WCC->CurRoom.name); - if (!strcasecmp(ChrPtr(gname), "_BASEROOM_")) + if (is_baseroom) { remove_march(gname); + } } FreeStrBuf(&Buf);