Skip to content

Commit cf8546d

Browse files
Stéphane ReuilleBulat Shakirzyanov
Stéphane Reuille
authored and
Bulat Shakirzyanov
committed
Avoid error when getting timeout or arguements if value is null
1 parent f8e65ac commit cf8546d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/src/Cassandra/ExecutionOptions.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,17 @@ PHP_METHOD(ExecutionOptions, __get)
8888
} else if (name_len == 8 && strncmp("pageSize", name, name_len) == 0) {
8989
RETURN_LONG(self->page_size);
9090
} else if (name_len == 7 && strncmp("timeout", name, name_len) == 0) {
91-
RETURN_ZVAL(self->timeout, 1, 0);
91+
if (self->timeout) {
92+
RETURN_ZVAL(self->timeout, 1, 0);
93+
} else {
94+
RETURN_NULL();
95+
}
9296
} else if (name_len == 9 && strncmp("arguments", name, name_len) == 0) {
93-
RETURN_ZVAL(self->arguments, 1, 0);
97+
if (self->arguments) {
98+
RETURN_ZVAL(self->arguments, 1, 0);
99+
} else {
100+
RETURN_NULL();
101+
}
94102
}
95103
}
96104

0 commit comments

Comments
 (0)