def hex2dec(s):
    """ Convert hex string to decimal number. Answer None if conversion raises
    an error.

    >>> hex2dec('0064')
    100
    >>> hex2dec('FFFF')
    65535
    >>> hex2dec(dec2hex(32))
    32
    >>> hex2dec('FFZ') is None
    True
    """
    try:
        return int(s, 16)
    except ValueError:
        pass
    return None