Fix potential race by checking for Noneness explicitely

Just checking boolean value would lead to a len() call, which might fail
as line_idxs might not have been set yet
Support psutil < 2.0