Fixed NullPointerException by extending error check to also handle client side.