Skip to content

Null check ImageData for BlitCloakInterior #2757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Assets/Scripts/Game/Utility/PaperDollRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ void DrawTexture(ImageData srcImage, DaggerfallUnityItem item = null)

void DrawTexture(ImageData srcImage, Rect srcRect, Rect targetRect, DaggerfallUnityItem item = null)
{
if (srcImage.texture == null)
return;

// Calculate image position relative to origin
int posX = (int)targetRect.xMin - paperDollOrigin.X;
int posY = (int)targetRect.yMin - paperDollOrigin.Y;
Expand All @@ -265,7 +268,7 @@ void DrawTexture(ImageData srcImage, Rect srcRect, Rect targetRect, DaggerfallUn
TextureReplacement.OverridePaperdollItemRect(item, srcImage, scale, ref screenRect);

// Draw with custom shader for paper doll item masking
if (item != null)
if (item != null && srcImage.maskTexture != null)
{
paperDollMaterial.SetTexture("_MaskTex", srcImage.maskTexture);
Graphics.DrawTexture(screenRect, srcImage.texture, srcRect, 0, 0, 0, 0, paperDollMaterial);
Expand Down Expand Up @@ -438,4 +441,4 @@ bool IsEquippedToBody(DaggerfallUnityItem item)

#endregion
}
}
}