Browse Source

Potentially fix a crash in love.window.setMode.

--HG--
branch : minor
Alex Szpakowski 8 years ago
parent
commit
73e5111335
2 changed files with 11 additions and 5 deletions
  1. 10 4
      src/modules/graphics/Graphics.h
  2. 1 1
      src/modules/graphics/StreamBuffer.cpp

+ 10 - 4
src/modules/graphics/Graphics.h

@@ -755,13 +755,19 @@ protected:
 	struct StreamBufferState
 	{
 		StreamBuffer *vb[2];
-		StreamBuffer *indexBuffer;
-		vertex::PrimitiveMode primitiveMode;
+		StreamBuffer *indexBuffer = nullptr;
+		vertex::PrimitiveMode primitiveMode = vertex::PrimitiveMode::TRIANGLES;
 		vertex::CommonFormat formats[2];
 		StrongRef<Texture> texture;
 		ptrdiff_t textureHandle = 0;
-		int vertexCount;
-		int indexCount;
+		int vertexCount = 0;
+		int indexCount = 0;
+
+		StreamBufferState()
+		{
+			vb[0] = vb[1] = nullptr;
+			formats[0] = formats[1] = vertex::CommonFormat::NONE;
+		}
 	};
 
 	void restoreState(const DisplayState &s);

+ 1 - 1
src/modules/graphics/StreamBuffer.cpp

@@ -37,7 +37,7 @@ StreamBuffer::StreamBuffer(Mode mode, size_t size)
 
 StreamBuffer::~StreamBuffer()
 {
-		delete[] data;
+	delete[] data;
 }
 
 void *StreamBuffer::getData() const