Fixes getFlatIcon Runtime on Atoms with no Icon

Resolves #5857 by not assuming that the atom is not null and then calling on it in the defaults for the function arguments.

This resolves the runtime but debugging it highlighted another issue that I'll report separately as I won't have time to work on this for several days.