As svg doesn't generate image sizes, so media.sizes was throwing error because it was undefined, and retrieving image size from undefined object was causing it to not work.
So I added additional check for that, in case media sizes are not available for image types such as svg, we can just utilize the original src url.
As svg doesn't generate image sizes, so media.sizes was throwing error because it was undefined, and retrieving image size from undefined object was causing it to not work.
So I added additional check for that, in case media sizes are not available for image types such as svg, we can just utilize the original src url.