Skip to content

Commit ec8202f

Browse files
author
Luiz Carlos Viana Melo
committed
Handling the null in SetVarFactory
1 parent 6c9aefa commit ec8202f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

muParserNET/Parser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ private IntPtr VarFactoryCallback(string name, IntPtr userData)
422422

423423
// chama a função definida
424424
ParserVariable v = this.factoryFunc(name, u);
425+
// lança uma exceção se não for retornada uma variável
426+
if (v == null)
427+
throw new ParserError("Invalid var object", this.Expr, "", 0, ErrorCodes.INVALID_VAR_PTR);
425428

426429
// adiciona na lista de variáveis
427430
this.vars[name] = v;

0 commit comments

Comments
 (0)