Skip to content

Commit 269550a

Browse files
committed
Fix warning about uninitialized variable
1 parent 638034f commit 269550a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MongoDB/WriteConcern.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static bool php_phongo_writeconcern_init_from_hash(php_phongo_writeconcern_t* in
111111
static PHP_METHOD(WriteConcern, __construct)
112112
{
113113
php_phongo_writeconcern_t* intern;
114-
zval * w, *journal;
114+
zval * w, *journal = NULL;
115115
zend_long wtimeout = 0;
116116

117117
intern = Z_WRITECONCERN_OBJ_P(getThis());
@@ -144,7 +144,7 @@ static PHP_METHOD(WriteConcern, __construct)
144144

145145
switch (ZEND_NUM_ARGS()) {
146146
case 3:
147-
if (Z_TYPE_P(journal) != IS_NULL) {
147+
if (journal && Z_TYPE_P(journal) != IS_NULL) {
148148
if (zend_is_true(journal) && (mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED || mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED)) {
149149
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot enable journaling when using w = 0");
150150
return;

0 commit comments

Comments
 (0)