Search Issue Tracker

Fixed

Fixed in 14.0.2

Votes

0

Found in [Package]

14.0.1

Issue ID

SGB-96

Regression

No

NullReferenceException is thrown when an empty .mat file is imported

Package: Shader Graph

-

Reproduction steps:
1. Create a new project
2. Install "Shader Graph" package
3. Import "BrokenMat.mat" asset

Expected result: Only "File is either empty or corrupted, please verify the file contents." error appears in the Console
Actual result: NullReferenceException and "File is either empty or corrupted, please verify the file contents." errors appear in the Console

Reproducible with: 7.7.1 (2019.4.37f1), 10.8.1 (2020.3.31f1), 12.1.6 (2021.2.16f1), 13.1.7 (2022.1.0b12), 14.0.1 (2022.2.0a8)

Notes:
- To make this error appear in 2019.4 and 2020.3 streams either URP or HDRP must be also installed

Full errors:
Error loading the file 'Assets/BrokenMat.mat'. File is either empty or corrupted, please verify the file contents.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Rendering.BuiltIn.MaterialPostprocessor.OnPostprocessAllAssets (System.String\[] importedAssets, System.String\[] deletedAssets, System.String\[] movedAssets, System.String\[] movedFromAssetPaths) (at Library/PackageCache/com.unity.shadergraph@14.0.1/Editor/Generation/Targets/BuiltIn/Editor/AssetPostProcessors/MaterialPostprocessor.cs:77)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object\[] parameters, System.Globalization.CultureInfo culture) (at <86bc6b6562c6434a9e767382eb38f2c1>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object\[] parameters, System.Globalization.CultureInfo culture) (at <86bc6b6562c6434a9e767382eb38f2c1>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object\[] parameters) (at <86bc6b6562c6434a9e767382eb38f2c1>:0)
UnityEditor.AssetPostprocessingInternal.InvokeMethod (System.Reflection.MethodInfo method, System.Object\[] args) (at /Users/bokken/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:1145)
UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String\[] importedAssets, System.String\[] addedAssets, System.String\[] deletedAssets, System.String\[] movedAssets, System.String\[] movedFromPathAssets, System.Boolean didDomainReload) (at /Users/bokken/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:385)

  1. Resolution Note (fix version 14.0.2):

    Fixed in 2023.1.0a2

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.