Skip to content

Commit

Permalink
ImageAdmin: Add null check before dereferencing pointer (#384)
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/JDim/src/image/imageadmin.cpp
Line: 554
```
  • Loading branch information
ma8ma committed Jul 4, 2020
1 parent c90e20f commit 3ddcd8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/image/imageadmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void ImageAdmin::close_view( const std::string& url )
SKELETON::View* view = get_view( url );

if( ! icon && ! view ) return;
if( DBIMG::is_cached( url ) && icon->is_locked() ) return;
if( DBIMG::is_cached( url ) && icon && icon->is_locked() ) return;

// 現在表示中のviewを閉じた場合は次か前の画像に切り替える
if( view && view == get_current_view() ){
Expand Down

0 comments on commit 3ddcd8b

Please sign in to comment.