From 6efeab0f3a0cc2879b47b01f6112a24d92e0d7e8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 10 Feb 2018 20:40:02 +0100 Subject: [PATCH] avoid segfault when using a hash as map on an empty system --- src/atom_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atom_map.cpp b/src/atom_map.cpp index 9d257d99de..4b1be77a06 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -57,7 +57,7 @@ void Atom::map_init(int check) map_nused = 0; map_free = 0; for (int i = 0; i < map_nhash; i++) map_hash[i].next = i+1; - map_hash[map_nhash-1].next = -1; + if (map_nhash > 0) map_hash[map_nhash-1].next = -1; } // recreating: delete old map and create new one for array or hash