Skip to content

Commit

Permalink
MessageViewBase: Remove redundant null check (#383)
Browse files Browse the repository at this point in the history
ポインターがnullの可能性があるとclang analyzerに指摘されましたが
冗長なnullチェックを削除して検出しないように修正します。

Bug reported by the clang static analyzer.
```
Description: Called C++ object pointer is null
File: /home/ma8ma/var/repos/worktree/jdim-echo/src/message/messageviewbase.cpp
Line: 999
```
  • Loading branch information
ma8ma committed Jul 4, 2020
1 parent 38c83d6 commit c90e20f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/message/messageviewbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,11 +985,9 @@ void MessageViewBase::show_status()

std::stringstream ss;

int line_count = 0;
if( m_text_message ){
line_count = m_text_message->get_buffer()->get_line_count();
ss << " [ 行数 " << line_count;
}
const int line_count = m_text_message->get_buffer()->get_line_count();
ss << " [ 行数 " << line_count;

if( m_max_line ){
ss << "/ " << m_max_line;
if( m_max_line < line_count ) m_over_lines = true;
Expand Down

0 comments on commit c90e20f

Please sign in to comment.