Fix bug that could cause app to crash when rendering barcode in some situations.