From 48747c38fbf43251cb89951498f3afc9e5947b24 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Mon, 13 May 2024 01:17:29 +0100 Subject: [PATCH] SCC: Handle non-matched SCC codes in SccWord.get_channel If is_code returns True but _find_code doesn't match the code, get_channel would crash rather than returning None. --- src/main/python/ttconv/scc/word.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/python/ttconv/scc/word.py b/src/main/python/ttconv/scc/word.py index e7bc8ae8..87cdfa85 100644 --- a/src/main/python/ttconv/scc/word.py +++ b/src/main/python/ttconv/scc/word.py @@ -119,8 +119,8 @@ def is_code(self) -> bool: def get_channel(self) -> Optional[SccChannel]: """Returns the caption channel, if the word is an SCC code""" - if self.is_code(): - if isinstance(self.code, SccPreambleAddressCode): - return self.code.get_channel() - return self.code.get_channel(self.value) - return None + if self.code is None: + return None + if isinstance(self.code, SccPreambleAddressCode): + return self.code.get_channel() + return self.code.get_channel(self.value)