Answer
Use the Conditions option on that barcode element (accessible via the RMB/right-click menu on the element in Report Designer) to set a condition that only renders the element when the underlying field is non-null. This avoids needing separate layouts for the with-value and without-value cases — the single layout simply omits the barcode image when there's nothing valid for it to encode.