Added conditional stack maintenance in native error handling scenarios.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>