From 913450026161c0e579562bd016944680a8219ace Mon Sep 17 00:00:00 2001 From: Joseph Lee Date: Tue, 26 Jan 2021 23:58:24 -0800 Subject: [PATCH] Studio/library scan script: make sure scan count is an integer. Re #155. Mypy: in library scan monitor script, make sure scan count is an integer, and return early if None otherwise. --- addon/appModules/splstudio/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addon/appModules/splstudio/__init__.py b/addon/appModules/splstudio/__init__.py index eeacb8290..caca60ccc 100644 --- a/addon/appModules/splstudio/__init__.py +++ b/addon/appModules/splstudio/__init__.py @@ -2466,7 +2466,12 @@ def script_sayTrackPitch(self, gesture): def script_libraryScanMonitor(self, gesture): if not self.libraryScanning: - if splbase.studioAPI(1, 32) < 0: + # #155 (21.03): if library scan count is None, then final scan count would also be None. + libScanCount = splbase.studioAPI(1, 32) + # Do nothing if library scan count is indeed None. + if libScanCount is None: + return + if libScanCount < 0: ui.message(_("{itemCount} items in the library").format(itemCount=splbase.studioAPI(0, 32))) return self.libraryScanning = True