Skip to content

Commit f29b33a

Browse files
committed
fix: grasshopper fix.
1 parent e45a2f5 commit f29b33a

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<IsApplicationProject>$(MSBuildProjectDirectory.Contains('applications'))</IsApplicationProject>
1313
<IsLibraryProject>$(MSBuildProjectDirectory.Contains('libraries'))</IsLibraryProject>
1414
<NeedPackage>False</NeedPackage>
15-
<NeedPackage Condition="!$(IsTestProject) and !$(IsApplicationProject) and !$(IsRoslynProject) and '$(Configuration)' == 'Release'">True</NeedPackage>
15+
<NeedPackage Condition="'$(MSBuildProjectName)' == 'TedToolkit.Grasshopper'">True</NeedPackage>
1616
<NeedRoslyn>False</NeedRoslyn>
1717
<NeedRoslyn Condition="!$(IsTestProject) and $(IsRoslynProject)">True</NeedRoslyn>
1818
<NeedAlmostAllFrameWorks>False</NeedAlmostAllFrameWorks>

src/libraries/TedToolkit.Grasshopper.Sources/ArchiToolkitResources.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@ internal static partial class TedToolkitResources
1414
{
1515
using var stream = typeof(TedToolkitResources).Assembly.GetManifestResourceStream(resourceName);
1616
if (stream is null) return null;
17-
var bitmap = new Bitmap(stream);
18-
if (bitmap.Width < 2 || bitmap.Height < 2) return null!;
19-
return bitmap;
17+
if (stream.Length is 0) return null;
18+
try
19+
{
20+
var bitmap = new Bitmap(stream);
21+
if (bitmap.Width < 2 || bitmap.Height < 2) return null!;
22+
return bitmap;
23+
}
24+
catch
25+
{
26+
return null;
27+
}
2028
}
2129

2230
private static string GetKey(string key, string value)

0 commit comments

Comments
 (0)