diff --git a/Assets/Cryville/Common/Pdt/PdtOperator.cs b/Assets/Cryville/Common/Pdt/PdtOperator.cs index d759334..a1ae7d9 100644 --- a/Assets/Cryville/Common/Pdt/PdtOperator.cs +++ b/Assets/Cryville/Common/Pdt/PdtOperator.cs @@ -47,12 +47,12 @@ namespace Cryville.Common.Pdt { internal void Call(byte* prmem, bool noset) { _prmem = prmem; _rfreq = false; - Execute(); - if (!_rfreq && !noset) throw new InvalidOperationException("Return frame not set"); + try { Execute(); } catch (Exception) { _failure = true; } if (_failure) { if (_rfreq) _etor.DiscardStack(); throw new InvalidOperationException("Evaluation failed"); } + if (!_rfreq && !noset) throw new InvalidOperationException("Return frame not set"); } /// /// Executes the operator. diff --git a/Assets/Cryville/Crtr/PdtEvaluator.cs b/Assets/Cryville/Crtr/PdtEvaluator.cs index 5f43173..93feef4 100644 --- a/Assets/Cryville/Crtr/PdtEvaluator.cs +++ b/Assets/Cryville/Crtr/PdtEvaluator.cs @@ -363,6 +363,8 @@ namespace Cryville.Crtr { } unsafe static class oputil { public static float AsNumber(PropSrc src) { + if (src == null) + throw new ArgumentNullException("src"); int type; byte[] value; src.Get(out type, out value); if (type != PdtInternalType.Number)