(tx view) Fix UnboundLocalError exception when moving left/right

'index' is referenced before assignment when an exception occurs in key_left and key_right. Reproduce this by viewing a tx and pressing left or right.