[minor] fixes in bom tree view template
diff --git a/erpnext/manufacturing/doctype/bom/bom_item_preview.html b/erpnext/manufacturing/doctype/bom/bom_item_preview.html
index 9db19a0..c782f7b 100644
--- a/erpnext/manufacturing/doctype/bom/bom_item_preview.html
+++ b/erpnext/manufacturing/doctype/bom/bom_item_preview.html
@@ -15,7 +15,9 @@
 		<a style="margin-right: 7px; margin-bottom: 7px" class="btn btn-default btn-xs" href="#Form/BOM/{{ data.value }}">
 			{{ __("Open BOM {0}", [data.value.bold()]) }}</a>
 		{% endif %}
+		{% if data.item_code %}
 		<a class="btn btn-default btn-xs" href="#Form/Item/{{ data.item_code }}">
 			{{ __("Open Item {0}", [data.item_code.bold()]) }}</a>
+		{% endif %}
 	</p>
 </div>
\ No newline at end of file