mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Fixed history when no log
This commit is contained in:
parent
579201636e
commit
993554b1b0
@ -101,16 +101,18 @@ chat_log_get_previous(const gchar * const login, gchar *recipient,
|
|||||||
FILE *logp = fopen(filename, "r");
|
FILE *logp = fopen(filename, "r");
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t read = 0;
|
size_t read = 0;
|
||||||
size_t length = getline(&line, &read, logp);
|
if (logp != NULL) {
|
||||||
while (length != -1) {
|
size_t length = getline(&line, &read, logp);
|
||||||
char *copy = malloc(length);
|
while (length != -1) {
|
||||||
copy = strncpy(copy, line, length);
|
char *copy = malloc(length);
|
||||||
copy[length -1] = '\0';
|
copy = strncpy(copy, line, length);
|
||||||
history = g_slist_append(history, copy);
|
copy[length -1] = '\0';
|
||||||
free(line);
|
history = g_slist_append(history, copy);
|
||||||
line = NULL;
|
free(line);
|
||||||
read = 0;
|
line = NULL;
|
||||||
length = getline(&line, &read, logp);
|
read = 0;
|
||||||
|
length = getline(&line, &read, logp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(filename);
|
free(filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user