Fix exception handling for PDT operator.
This commit is contained in:
@@ -47,12 +47,12 @@ namespace Cryville.Common.Pdt {
|
|||||||
internal void Call(byte* prmem, bool noset) {
|
internal void Call(byte* prmem, bool noset) {
|
||||||
_prmem = prmem;
|
_prmem = prmem;
|
||||||
_rfreq = false;
|
_rfreq = false;
|
||||||
Execute();
|
try { Execute(); } catch (Exception) { _failure = true; }
|
||||||
if (!_rfreq && !noset) throw new InvalidOperationException("Return frame not set");
|
|
||||||
if (_failure) {
|
if (_failure) {
|
||||||
if (_rfreq) _etor.DiscardStack();
|
if (_rfreq) _etor.DiscardStack();
|
||||||
throw new InvalidOperationException("Evaluation failed");
|
throw new InvalidOperationException("Evaluation failed");
|
||||||
}
|
}
|
||||||
|
if (!_rfreq && !noset) throw new InvalidOperationException("Return frame not set");
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes the operator.
|
/// Executes the operator.
|
||||||
|
@@ -363,6 +363,8 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
unsafe static class oputil {
|
unsafe static class oputil {
|
||||||
public static float AsNumber(PropSrc src) {
|
public static float AsNumber(PropSrc src) {
|
||||||
|
if (src == null)
|
||||||
|
throw new ArgumentNullException("src");
|
||||||
int type; byte[] value;
|
int type; byte[] value;
|
||||||
src.Get(out type, out value);
|
src.Get(out type, out value);
|
||||||
if (type != PdtInternalType.Number)
|
if (type != PdtInternalType.Number)
|
||||||
|
Reference in New Issue
Block a user