Why does Resources.Load cause a CastException in this case?

I am doing this:

Font font = Resources.Load<Font>(fontName);

In Resources, we have freespin_big.png and freespin_big.xml. I am planning to import the png and xml and create a font.

So I check if the font object is there, if not create it:

Font font = Resources.Load<Font>(fontName);
if (font == null)
{
    font = new Font();
    AssetDatabase.CreateAsset(font, "Assets/Resources/" + fontName);
}

But I get this error if the font does not exist yet:

InvalidCastException: Cannot cast from
source type to destination type.

If I try to do this:

Font font = Resources.Load<Font>("blorg");

Where no files are named “blorg”, I get null as I expect.

Shouldn’t Resources.Load return null if it finds no fonts with the right name?

In C#, it is done this way

Font abc= Resources.Load (“fontname”,typeof( Font)) as Font;

Hope this helps