Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
1b8ed388
Commit
1b8ed388
authored
Mar 26, 2016
by
Jan-Erik Rediger
Browse files
docs: Handle NULL in example
Closes #361
parent
db1c46da
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
1b8ed388
...
...
@@ -48,9 +48,13 @@ After trying to connect to Redis using `redisConnect` you should
check the
`err`
field to see if establishing the connection was successful:
```
c
redisContext
*
c
=
redisConnect
(
"127.0.0.1"
,
6379
);
if
(
c
!=
NULL
&&
c
->
err
)
{
printf
(
"Error: %s
\n
"
,
c
->
errstr
);
// handle error
if
(
c
==
NULL
||
c
->
err
)
{
if
(
c
)
{
printf
(
"Error: %s
\n
"
,
c
->
errstr
);
// handle error
}
else
{
printf
(
"Can't allocate redis context
\n
"
);
}
}
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment