Fix another case where getBlockDensity could run forever.

Signed-off-by: Ross Allan <rallanpcl@gmail.com>