Skip to content

Commit

Permalink
fixes #177 - add null pointer checks
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Dec 29, 2023
1 parent 9df4833 commit fad3050
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#pragma once

#define NCHAT_VERSION "4.21"
#define NCHAT_VERSION "4.22"
4 changes: 4 additions & 0 deletions lib/tgchat/src/tgchat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,8 @@ std::int64_t TgChat::Impl::GetSenderId(const td::td_api::message& p_TdMessage)

std::string TgChat::Impl::GetText(td::td_api::object_ptr<td::td_api::formattedText>&& p_FormattedText)
{
if (!p_FormattedText) return "";

std::string text = p_FormattedText->text_;
static const bool markdownEnabled = (m_Config.Get("markdown_enabled") == "1");
static const int32_t markdownVersion = (m_Config.Get("markdown_version") == "1") ? 1 : 2;
Expand Down Expand Up @@ -2275,6 +2277,8 @@ void TgChat::Impl::TdMessageContentConvert(td::td_api::MessageContent& p_TdMessa

void TgChat::Impl::TdMessageConvert(td::td_api::message& p_TdMessage, ChatMessage& p_ChatMessage)
{
if (!p_TdMessage.content_) return;

const int64_t senderId = GetSenderId(p_TdMessage);
TdMessageContentConvert(*p_TdMessage.content_, senderId, p_ChatMessage.text, p_ChatMessage.fileInfo);

Expand Down
2 changes: 1 addition & 1 deletion src/nchat.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NCHAT "1" "December 2023" "nchat v4.21" "User Commands"
.TH NCHAT "1" "December 2023" "nchat v4.22" "User Commands"
.SH NAME
nchat \- ncurses chat
.SH SYNOPSIS
Expand Down

0 comments on commit fad3050

Please sign in to comment.