summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/circuit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c
index 925e15be94..22a79a7646 100644
--- a/src/or/circuit.c
+++ b/src/or/circuit.c
@@ -65,8 +65,11 @@ void circuit_close_all_marked()
global_circuitlist = tmp;
}
+ if(!global_circuitlist)
+ return;
+
for (tmp = global_circuitlist; tmp->next; tmp=tmp->next) {
- while (tmp->next->marked_for_close) {
+ while (tmp->next && tmp->next->marked_for_close) {
m = tmp->next->next;
circuit_free(tmp->next);
tmp->next = m;