瀏覽代碼

Fixed CID 1197342

AlexVinS 9 年之前
父節點
當前提交
45ae1ef165
共有 1 個文件被更改,包括 14 次插入13 次删除
  1. 14 13
      client/gui/SDL_Extensions.cpp

+ 14 - 13
client/gui/SDL_Extensions.cpp

@@ -185,23 +185,24 @@ void CSDL_Ext::alphaTransform(SDL_Surface *src)
 template<int bpp>
 int CSDL_Ext::blit8bppAlphaTo24bppT(const SDL_Surface * src, const SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect)
 {
-	if (src && src->format->BytesPerPixel==1 && dst && (bpp==3 || bpp==4 || bpp==2)) //everything's ok
+	/* Make sure the surfaces aren't locked */
+	if ( ! src || ! dst )
+	{
+		SDL_SetError("SDL_UpperBlit: passed a nullptr surface");
+		return -1;
+	}
+
+	if ( src->locked || dst->locked )
+	{
+		SDL_SetError("Surfaces must not be locked during blit");
+		return -1;
+	}
+
+	if (src->format->BytesPerPixel==1 && (bpp==3 || bpp==4 || bpp==2)) //everything's ok
 	{
 		SDL_Rect fulldst;
 		int srcx, srcy, w, h;
 
-		/* Make sure the surfaces aren't locked */
-		if ( ! src || ! dst )
-		{
-			SDL_SetError("SDL_UpperBlit: passed a nullptr surface");
-			return -1;
-		}
-		if ( src->locked || dst->locked )
-		{
-			SDL_SetError("Surfaces must not be locked during blit");
-			return -1;
-		}
-
 		/* If the destination rectangle is nullptr, use the entire dest surface */
 		if ( dstRect == nullptr )
 		{