Changeset 3901 for trunk/console

Show
Ignore:
Timestamp:
09/24/04 18:03:06 (4 years ago)
Author:
dreamforce2
Message:

fix segfault when running console plugin and no owner.
this fixes SF bug 1033227.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/console/src/console_print.cpp

    r3801 r3901  
    130130  werase(winStatus->Win()); 
    131131 
     132  unsigned short nNumOwnerEvents = 0; 
    132133  ICQOwner *o = gUserManager.FetchOwner(LOCK_R); 
    133   unsigned short nNumOwnerEvents = o->NewMessages(); 
    134   gUserManager.DropOwner(); 
     134  if (o != NULL) 
     135  { 
     136    nNumOwnerEvents = o->NewMessages(); 
     137    gUserManager.DropOwner(); 
     138  } 
    135139  unsigned short nNumUserEvents = ICQUser::getNumUserEvents() - nNumOwnerEvents; 
    136140  if (nNumOwnerEvents > 0) 
     
    156160    strcpy(szLastUser, "<None>"); 
    157161 
    158   o = gUserManager.FetchOwner(LOCK_R); 
    159162  wbkgdset(winStatus->Win(), COLOR_PAIR(COLOR_WHITE)); 
    160163  mvwhline(winStatus->Win(), 0, 0, ACS_HLINE, COLS); 
     
    163166 
    164167  wbkgdset(winStatus->Win(), COLOR_PAIR(COLOR_YELLOW_BLUE)); 
    165   winStatus->wprintf("%C%A[ %C%s %C(%C%ld%C) - S: %C%s %C- G: %C%s %C- M: %C%s %C- L: %C%s %C]", COLOR_YELLOW_BLUE, 
    166                      A_BOLD, COLOR_WHITE_BLUE, o->GetAlias(), COLOR_YELLOW_BLUE, 
    167                      COLOR_WHITE_BLUE, o->Uin(), COLOR_YELLOW_BLUE, 
    168                      COLOR_CYAN_BLUE, o->StatusStr(), COLOR_YELLOW_BLUE, 
    169                      COLOR_CYAN_BLUE, CurrentGroupName(), COLOR_YELLOW_BLUE, 
    170                      COLOR_CYAN_BLUE, szMsgStr, COLOR_YELLOW_BLUE, COLOR_CYAN_BLUE, 
    171                      szLastUser, COLOR_YELLOW_BLUE); 
    172   gUserManager.DropOwner(); 
     168   
     169  o = gUserManager.FetchOwner(LOCK_R); 
     170  if (o != NULL) 
     171  { 
     172    winStatus->wprintf("%C%A[ %C%s %C(%C%ld%C) - S: %C%s %C- G: %C%s %C- M: %C%s %C- L: %C%s %C]", COLOR_YELLOW_BLUE, 
     173                      A_BOLD, COLOR_WHITE_BLUE, o->GetAlias(), COLOR_YELLOW_BLUE, 
     174                      COLOR_WHITE_BLUE, o->Uin(), COLOR_YELLOW_BLUE, 
     175                      COLOR_CYAN_BLUE, o->StatusStr(), COLOR_YELLOW_BLUE, 
     176                      COLOR_CYAN_BLUE, CurrentGroupName(), COLOR_YELLOW_BLUE, 
     177                      COLOR_CYAN_BLUE, szMsgStr, COLOR_YELLOW_BLUE, COLOR_CYAN_BLUE, 
     178                      szLastUser, COLOR_YELLOW_BLUE); 
     179    gUserManager.DropOwner(); 
     180  } 
    173181  wclrtoeol(winStatus->Win()); 
    174182  winStatus->RefreshWin();