Browse code

dialog: safety check for prev field

(cherry picked from commit 80beb29ac0204697a8964231b441ac37866a4a1c)
(cherry picked from commit f5e8a6042f141fd32f611c5ddc8232d793448b7a)

Daniel-Constantin Mierla authored on 09/04/2021 15:18:54 • Henning Westerholt committed on 22/10/2021 11:50:45
Showing 1 changed files
... ...
@@ -222,7 +222,7 @@ static inline struct dlg_tl* get_expired_dlgs(unsigned int time)
222 222
 	lock_get( d_timer->lock);
223 223
 
224 224
 	if (d_timer->first.next==&(d_timer->first)
225
-	|| d_timer->first.next->timeout > time ) {
225
+			|| d_timer->first.next->timeout > time ) {
226 226
 		lock_release( d_timer->lock);
227 227
 		return 0;
228 228
 	}
... ...
@@ -247,7 +247,9 @@ static inline struct dlg_tl* get_expired_dlgs(unsigned int time)
247 247
 		ret = 0;
248 248
 	} else {
249 249
 		ret = d_timer->first.next;
250
-		tl->prev->next = 0;
250
+		if(tl->prev) {
251
+			tl->prev->next = 0;
252
+		}
251 253
 		d_timer->first.next = tl;
252 254
 		tl->prev = &d_timer->first;
253 255
 	}