summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-04-04 14:46:22 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-04-04 14:46:22 +0000
commit87a4e044ee73e9de80eec7f3202b0b003473bf89 (patch)
tree952952a2cd0ff3c0bee6f6b2a229eb8fe8160e6a /include
parent4836d3e6f3d2a0c245b8fff1d6924460404cb63d (diff)
downloadzabbix-87a4e044ee73e9de80eec7f3202b0b003473bf89.tar.gz
zabbix-87a4e044ee73e9de80eec7f3202b0b003473bf89.tar.xz
zabbix-87a4e044ee73e9de80eec7f3202b0b003473bf89.zip
FIxed situation when there is no corresponding record in table functions for giben functionid.
git-svn-id: svn://svn.zabbix.com/trunk@25 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'include')
-rw-r--r--include/db.c7
-rw-r--r--include/expression.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/include/db.c b/include/db.c
index 99aa8e02..89d3f854 100644
--- a/include/db.c
+++ b/include/db.c
@@ -56,10 +56,17 @@ int DBget_function_result(float *Result,char *FunctionID)
sprintf( c, "select lastvalue from functions where functionid=%s", FunctionID );
DBexecute(c);
+
+ dbg_write( dbg_proginfo, "1\n");
result = DBget_result();
row = DBfetch_row(result);
+ if(row == NULL)
+ {
+ dbg_write( dbg_syswarn, "Query failed for functionid:[%s]", FunctionID );
+ return FAIL;
+ }
*Result=atof(row[0]);
DBfree_result(result);
diff --git a/include/expression.c b/include/expression.c
index 9d8a9420..cfb2f40c 100644
--- a/include/expression.c
+++ b/include/expression.c
@@ -47,6 +47,8 @@ int find_char(char *str,char c)
{
int i;
+ dbg_write( dbg_proginfo, "Before find_char:%s[%c]", str, c );
+
for(i=0;i<strlen(str);i++)
{
if(str[i]==c) return i;
@@ -283,7 +285,7 @@ int substitute_functions(char *exp)
char res[1024];
int i,l,r;
- dbg_write( dbg_proginfo, "BEGIN SubstituteFunctions" );
+ dbg_write( dbg_proginfo, "BEGIN substitute_functions" );
while( find_char(exp,'{') != FAIL )
{