Added null checks to only read the iconID of a dietary flag if the flag is not null

Added null checks to only read the iconID of a dietary flag if the flag is not null

Created new pull request because old one was set to merge with master instead of 2.4-dev.