Skip to content

Commit 08af1a9

Browse files
committed
fix: in JobTransformerBase, prevent configuring pads twice and prevent configuring invalid pads
1 parent f035ebf commit 08af1a9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: src/main/kotlin/dev/silenium/libs/flows/base/JobTransformerBase.kt

+5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ abstract class JobTransformerBase<IT, IP, OT, OP>(
2020
protected var job: Job? = null
2121

2222
override fun configure(pad: UInt, metadata: IP): Result<Unit> {
23+
if (!inputMetadata_.containsKey(pad)) return Result.failure(IllegalStateException("pad already configured"))
24+
if (pads?.contains(pad) == false) return Result.failure(IllegalStateException("pad not allowed"))
25+
2326
inputMetadata_[pad] = metadata
2427
outputMetadata_[pad] = outputMetadata(metadata)
28+
2529
if (pads?.equals(inputMetadata_.keys) == true) {
2630
job = coroutineScope.launch { run() }
2731
}
32+
2833
return Result.success(Unit)
2934
}
3035

0 commit comments

Comments
 (0)