Bug Summary

File:home/maarten/src/libreoffice/core/dbaccess/source/ui/relationdesign/RTableConnection.cxx
Warning:line 89, column 13
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name RTableConnection.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D DBACCESS_DLLIMPLEMENTATION -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/external/unixODBC/inc -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/dbaccess/inc -I /home/maarten/src/libreoffice/core/dbaccess/source/inc -I /home/maarten/src/libreoffice/core/dbaccess/source/ui/inc -I /home/maarten/src/libreoffice/core/workdir/YaccTarget/connectivity/source/parse -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/dbaccess/source/ui/relationdesign/RTableConnection.cxx
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "RTableConnection.hxx"
21#include <RTableConnectionData.hxx>
22#include <RelationTableView.hxx>
23#include <vcl/svapp.hxx>
24#include <vcl/settings.hxx>
25#include <ConnectionLine.hxx>
26
27using namespace dbaui;
28ORelationTableConnection::ORelationTableConnection( ORelationTableView* pContainer,
29 const TTableConnectionData::value_type& pTabConnData )
30 :OTableConnection( pContainer, pTabConnData )
31{
32}
33
34ORelationTableConnection::ORelationTableConnection( const ORelationTableConnection& rConn )
35 : VclReferenceBase(), OTableConnection( rConn )
36{
37 // no own members, thus the base class functionality is enough
38}
39
40ORelationTableConnection& ORelationTableConnection::operator=( const ORelationTableConnection& rConn )
41{
42 // this doesn't change anything, since the base class tests this, too and I don't have my own members to copy
43 if (&rConn == this)
44 return *this;
45
46 OTableConnection::operator=( rConn );
47 return *this;
48}
49
50void ORelationTableConnection::Draw(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect )
51{
52 OTableConnection::Draw(rRenderContext, rRect);
1
Value assigned to field '_M_ptr'
53 ORelationTableConnectionData* pData = static_cast< ORelationTableConnectionData* >(GetData().get());
2
'pData' initialized here
54 if (pData && (pData->GetCardinality() == Cardinality::Undefined))
3
Assuming 'pData' is null
55 return;
56
57 // search lines for top line
58 tools::Rectangle aBoundingRect;
59 long nTop = GetBoundingRect().Bottom();
60 long nTemp;
61
62 const OConnectionLine* pTopLine = nullptr;
63 const std::vector<std::unique_ptr<OConnectionLine>>& rConnLineList = GetConnLineList();
64
65 for (auto const& elem : rConnLineList)
66 {
67 if( elem->IsValid() )
4
Assuming pointer value is null
5
Taking true branch
68 {
69 aBoundingRect = elem->GetBoundingRect();
70 nTemp = aBoundingRect.Top();
71 if(nTemp < nTop)
6
Assuming 'nTemp' is < 'nTop'
7
Taking true branch
72 {
73 nTop = nTemp;
74 pTopLine = elem.get();
75 }
76 }
77 }
78
79 // cardinality
80 if (!pTopLine
7.1
'pTopLine' is non-null
)
8
Taking false branch
81 return;
82
83 tools::Rectangle aSourcePos = pTopLine->GetSourceTextPos();
84 tools::Rectangle aDestPos = pTopLine->GetDestTextPos();
85
86 OUString aSourceText;
87 OUString aDestText;
88
89 switch (pData->GetCardinality())
9
Called C++ object pointer is null
90 {
91 case Cardinality::OneMany:
92 aSourceText = "1";
93 aDestText = "n";
94 break;
95
96 case Cardinality::ManyOne:
97 aSourceText = "n";
98 aDestText = "1";
99 break;
100
101 case Cardinality::OneOne:
102 aSourceText = "1";
103 aDestText = "1";
104 break;
105 default: break;
106 }
107
108 if (IsSelected())
109 rRenderContext.SetTextColor(Application::GetSettings().GetStyleSettings().GetHighlightColor());
110 else
111 rRenderContext.SetTextColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor());
112
113 rRenderContext.DrawText(aSourcePos, aSourceText, DrawTextFlags::Clip | DrawTextFlags::Center | DrawTextFlags::Bottom);
114 rRenderContext.DrawText(aDestPos, aDestText, DrawTextFlags::Clip | DrawTextFlags::Center | DrawTextFlags::Bottom);
115}
116
117/* vim:set shiftwidth=4 softtabstop=4 expandtab: */