The pointers "up" and "down" were checked against nullptr but it's always non-null Also added curly braces for if statement. It's good practice for avoiding shooting yourself to the foot Signed-off-by: Maxim Korotkov <korotkov.maxim.s@gmail.com>