summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-05 03:01:59 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-24 10:23:44 +0100
commit2c5a4ad1e7b10a9c6a900932b8690a81811fd84e (patch)
treea72eee3ddc28b6b0d4b151b47458d5d3476cfa21
parent53b223551687397986d55bfbf34009663cec217a (diff)
downloadratpoison-2c5a4ad1e7b10a9c6a900932b8690a81811fd84e.zip
In history_add_upto make sure we don't dereference a NULL pointer;
-rw-r--r--src/history.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/history.c b/src/history.c
index 8ba2c53..915889a 100644
--- a/src/history.c
+++ b/src/history.c
@@ -141,7 +141,7 @@ history_add_upto (int history_id, const char *item, size_t max)
if (defaults.history_compaction && max != INT_MAX) {
struct list_head *l;
- for (l = h->head.prev ; l != &h->head ; l = l->prev) {
+ for (l = h->head.prev ; l && l != &h->head ; l = l->prev) {
if (!strcmp (list_entry(l, struct history_item, node)->line, item)) {
list_del (l);
list_add_tail (l, &h->head);