You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a scenario where a field is mapped to a Stream type, for example the Blob field of the media File type (/sitecore/templates/System/Media/Unversioned/File/Media/Blob) if the Blob field is empty/null (e.g. the media asset was detached), Glass Mapper is throwing a null reference exception.
I believe this happens in the GetField method of the SitecoreFieldStreamMapper class. It tries to get the blob stream:
var data = field.GetBlobStream();
In the case of a detached asset, data will be null. But there is no null check before it tries to use data in the conditional:
Using Glass Mapper 5.6.160 on Sitecore 9.3.
In a scenario where a field is mapped to a Stream type, for example the Blob field of the media File type (/sitecore/templates/System/Media/Unversioned/File/Media/Blob) if the Blob field is empty/null (e.g. the media asset was detached), Glass Mapper is throwing a null reference exception.
I believe this happens in the GetField method of the SitecoreFieldStreamMapper class. It tries to get the blob stream:
var data = field.GetBlobStream();
In the case of a detached asset, data will be null. But there is no null check before it tries to use data in the conditional:
if (data.CanRead) - https://github.com/mikeedwards83/Glass.Mapper/blob/master/Source/Glass.Mapper.Sc/DataMappers/SitecoreFieldStreamMapper.cs#:~:text=if%20(-,data.CanRead,-)
I believe the above line is where the null reference exception occurs.
The text was updated successfully, but these errors were encountered: