stream: fix pipe unhandled error
Before this PR pipe
could cause an unhandled exception when e.g. piping an object mode stream to a non-object mode stream. This can particularly happen when stream types are dynamically chosen.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines