Mercurial > hg > nnchat
comparison nnchat.c @ 32:67ec4073e38c
Check for NULL pointers (fixes "daemon" mode)
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 04 Aug 2008 06:44:11 +0300 |
parents | 9b429b283786 |
children | e49ea6febfeb |
comparison
equal
deleted
inserted
replaced
31:9b429b283786 | 32:67ec4073e38c |
---|---|
247 { | 247 { |
248 char tmpStr[128] = ""; | 248 char tmpStr[128] = ""; |
249 time_t timeStamp; | 249 time_t timeStamp; |
250 struct tm *tmpTime;; | 250 struct tm *tmpTime;; |
251 | 251 |
252 if (statusWin == NULL) return; | |
253 | |
252 timeStamp = time(NULL); | 254 timeStamp = time(NULL); |
253 if ((tmpTime = localtime(&timeStamp)) != NULL) { | 255 if ((tmpTime = localtime(&timeStamp)) != NULL) { |
254 strftime(tmpStr, sizeof(tmpStr), "%H:%M:%S", tmpTime); | 256 strftime(tmpStr, sizeof(tmpStr), "%H:%M:%S", tmpTime); |
255 } | 257 } |
256 | 258 |
284 wrefresh(statusWin); | 286 wrefresh(statusWin); |
285 } | 287 } |
286 | 288 |
287 void printEditBuf(char *str, editbuf_t *buf) | 289 void printEditBuf(char *str, editbuf_t *buf) |
288 { | 290 { |
291 if (statusWin == NULL || buf == NULL) return; | |
292 | |
289 buf->data[buf->len] = 0; | 293 buf->data[buf->len] = 0; |
290 werase(editWin); | 294 werase(editWin); |
291 | 295 |
292 wattrset(editWin, A_BOLD); | 296 wattrset(editWin, A_BOLD); |
293 mvwaddstr(editWin, 0, 0, str); | 297 mvwaddstr(editWin, 0, 0, str); |