summaryrefslogtreecommitdiffstats
path: root/libssh/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/session.c')
-rw-r--r--libssh/session.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libssh/session.c b/libssh/session.c
index d70a112b..894506f2 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -319,12 +319,19 @@ const char *ssh_get_disconnect_message(SSH_SESSION *session) {
return NULL;
}
-/** \brief get the protocol version of the session
- * \param session ssh session
- * \return 1 or 2, for ssh1 or ssh2
+/**
+ * @brief Get the protocol version of the session.
+ *
+ * @param session The ssh session to use.
+ *
+ * @return 1 or 2, for ssh1 or ssh2, < 0 on error.
*/
-int ssh_get_version(SSH_SESSION *session){
- return session->version;
+int ssh_get_version(SSH_SESSION *session) {
+ if (session == NULL) {
+ return -1;
+ }
+
+ return session->version;
}
/** @} */