comparison libpurple/log.c @ 16960:30b906ba3974

Fix log viewer crash when the log filename is doesn't contain a date in the expected format. Fixes #588.
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 08 May 2007 20:16:24 +0000
parents 4999bbc52881
children c588a4a9d287
comparison
equal deleted inserted replaced
16959:74957a0aa633 16960:30b906ba3974
776 /* As zero is a valid offset, PURPLE_NO_TZ_OFF means no offset was 776 /* As zero is a valid offset, PURPLE_NO_TZ_OFF means no offset was
777 * provided. See util.h. Yes, it's kinda ugly. */ 777 * provided. See util.h. Yes, it's kinda ugly. */
778 if (tz_off != PURPLE_NO_TZ_OFF) 778 if (tz_off != PURPLE_NO_TZ_OFF)
779 tm.tm_gmtoff = tz_off - tm.tm_gmtoff; 779 tm.tm_gmtoff = tz_off - tm.tm_gmtoff;
780 780
781 if (rest == NULL || (end = strchr(rest, '.')) == NULL || strchr(rest, ' ') != NULL) 781 if (stamp == 0 || rest == NULL || (end = strchr(rest, '.')) == NULL || strchr(rest, ' ') != NULL)
782 { 782 {
783 log = purple_log_new(type, name, account, NULL, stamp, NULL); 783 log = purple_log_new(type, name, account, NULL, stamp, NULL);
784 } 784 }
785 else 785 else
786 { 786 {
790 g_free(tmp); 790 g_free(tmp);
791 } 791 }
792 #else 792 #else
793 time_t stamp = purple_str_to_time(filename, FALSE, &tm, NULL, NULL); 793 time_t stamp = purple_str_to_time(filename, FALSE, &tm, NULL, NULL);
794 794
795 log = purple_log_new(type, name, account, NULL, stamp, &tm); 795 log = purple_log_new(type, name, account, NULL, stamp, (stamp != 0) ? &tm : NULL);
796 #endif 796 #endif
797 797
798 log->logger = logger; 798 log->logger = logger;
799 log->logger_data = data = g_slice_new0(PurpleLogCommonLoggerData); 799 log->logger_data = data = g_slice_new0(PurpleLogCommonLoggerData);
800 800