Commit dbdfab5
committed
Algorithm: check type before casting
The if statement used to assume that if `mem->type() ==
memory::Type::eImage` then it was safe to assume that the memory object
is an instance of `kp::Image`. However, any subclass of `kp::Memory`
could implement the virtual `type()` method to return
`memory::Type::eImage`, so this is an invalid assumption.
This commit fixes the issue by only casting if the memory object
actually is an instance of `kp::Memory`1 parent b888179 commit dbdfab5
1 file changed
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
0 commit comments