about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/focaccia/_deterministic_impl.py4
-rw-r--r--src/focaccia/deterministic.py3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/focaccia/_deterministic_impl.py b/src/focaccia/_deterministic_impl.py
index 119a4cb..5e4017d 100644
--- a/src/focaccia/_deterministic_impl.py
+++ b/src/focaccia/_deterministic_impl.py
@@ -47,7 +47,7 @@ class DeterministicLogReader(io.RawIOBase):
 
     def __init__(self, filename: str):
         super().__init__()
-        self._f = open(filename, "rb", buffering=0)
+        self._f = open(filename, "rb", buffering=0) if filename else None
         self._data_buffer = memoryview(b"")
         self._pos = 0
         self._eof = False
@@ -182,6 +182,8 @@ class DeterministicLog:
         self.base_directory = log_dir
 
     def _get_file(self, file_name: str) -> str | None:
+        if self.base_directory = None:
+            return None
         candidate = os.path.join(self.base_directory, file_name)
         if os.path.isfile(candidate):
             return candidate
diff --git a/src/focaccia/deterministic.py b/src/focaccia/deterministic.py
index 2f3980a..9922c45 100644
--- a/src/focaccia/deterministic.py
+++ b/src/focaccia/deterministic.py
@@ -300,7 +300,8 @@ finally:
             self.matched_count = None
             if from_state:
                 self.match(from_state)
-                self.matched_count -= 1
+                if self.matched_count:
+                    self.matched_count -= 1
 
         def match(self, state: ReadableProgramState) -> Event | None:
             if self.matched_count is None: