Catch misconfiguration of math default option

If the LocalSettings.php has invalid settings
for $wgDefaultUserOptions['math']
and $wgValidMathModes the user prefrences
pages displays an error. This commit
catches this error and selects the first
rendering option availible.

Bug: 64844
Change-Id: I1e3c468c0dc92378f7dc7b7d81fb4693e70f6b6f