changeset 14093:7932e30e0c0c draft

(svn r18640) -Fix (r18633): don't assert when accessing first invalid item, it's used quite often in the code -Revert (r18637): it's not needed any more
author smatz <smatz@openttd.org>
date Sat, 26 Dec 2009 13:49:14 +0000
parents 4565c8ca35d3
children 353d6f5c65de
files src/core/smallvec_type.hpp src/network/network_content_gui.cpp
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/smallvec_type.hpp
+++ b/src/core/smallvec_type.hpp
@@ -225,7 +225,8 @@
 	 */
 	FORCEINLINE const T *Get(uint index) const
 	{
-		assert(index < this->items);
+		/* Allow access to the 'first invalid' item */
+		assert(index <= this->items);
 		return &this->data[index];
 	}
 
@@ -237,7 +238,8 @@
 	 */
 	FORCEINLINE T *Get(uint index)
 	{
-		assert(index < this->items);
+		/* Allow access to the 'first invalid' item */
+		assert(index <= this->items);
 		return &this->data[index];
 	}
 
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -435,9 +435,6 @@
 
 	void DrawMatrix(const Rect &r) const
 	{
-		/* Is there something to do? */
-		if (this->content.Length() == 0) return;
-
 		const NWidgetBase *nwi_checkbox = this->GetWidget<NWidgetBase>(NCLWW_CHECKBOX);
 		const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(NCLWW_NAME);
 		const NWidgetBase *nwi_type = this->GetWidget<NWidgetBase>(NCLWW_TYPE);