added error log

index out of range issue with cropLargestTopmost