# Buggy code
def isNamingValid(pattern=None, multi=None, abd=False, sports=False, anime_type=None):
    if not pattern:
        return "invalid"

    if multi is not None:
        multi = int(multi)

    if anime_type is not None:
        anime_type = int(anime_type)

    # air by date shows just need one check, we don't need to worry about season folders
    if abd:
        is_valid = naming.check_valid_abd_naming(pattern)
        require_season_folders = False

    # sport shows just need one check, we don't need to worry about season folders
    elif sports:
        is_valid = naming.check_valid_sports_naming(pattern)
        require_season_folders = False

    else:
        # check validity of single and multi ep cases for the whole path
        is_valid = naming.check_valid_naming(pattern, multi, anime_type)

        # check validity of single and multi ep cases for only the file name
        require_season_folders = naming.check_force_season_folders(
            pattern, multi, anime_type
        )

    if is_valid and not require_season_folders:
        return "valid"
    elif is_valid and require_season_folders:
        return "seasonfolders"
    else:
        return "invalid"


# Traceback (TypeError)
Thread-14 :: [6e3ebea] Failed doing webui callback: Traceback (most recent call last):
File "/share/1000/sickrage/sickbeard/webserve.py", line 285, in async_call
result = function(**kwargs)
File "/share/1000/sickrage/sickbeard/webserve.py", line 2302, in processEpisode
is_priority=argToBool(is_priority), delete_on=argToBool(delete_on), failed=argToBool(failed), proc_type=type
File "/share/1000/sickrage/sickbeard/processTV.py", line 247, in processDir
process_media(path, [video], nzbName, process_method, force, is_priority, result)
File "/share/1000/sickrage/sickbeard/processTV.py", line 575, in process_media
result.result = processor.process()
File "/share/1000/sickrage/sickbeard/postProcessor.py", line 1029, in process
if int(ep_obj.season) > int(max_season[0][0]):
TypeError: int() argument must be a string or a number, not 'NoneType'

# Fixed code
def isNamingValid(pattern=None, multi=None, abd=False, sports=False, anime_type=None):
    if not pattern:
        return "invalid"

    # air by date shows just need one check, we don't need to worry about season folders
    if abd:
        is_valid = naming.check_valid_abd_naming(pattern)
        require_season_folders = False

    # sport shows just need one check, we don't need to worry about season folders
    elif sports:
        is_valid = naming.check_valid_sports_naming(pattern)
        require_season_folders = False

    else:
        # check validity of single and multi ep cases for the whole path
        is_valid = naming.check_valid_naming(
            pattern, try_int(multi, None), try_int(anime_type, None)
        )

        # check validity of single and multi ep cases for only the file name
        require_season_folders = naming.check_force_season_folders(
            pattern, try_int(multi, None), try_int(anime_type, None)
        )

    if is_valid and not require_season_folders:
        return "valid"
    elif is_valid and require_season_folders:
        return "seasonfolders"
    else:
        return "invalid"