Bug Summary

File:home/maarten/src/libreoffice/core/sd/source/ui/func/fuexecuteinteraction.cxx
Warning:line 222, column 17
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 fuexecuteinteraction.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 -isystem /usr/include/libxml2 -isystem /usr/include/dbus-1.0 -isystem /usr/lib64/dbus-1.0/include -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 SD_DLLIMPLEMENTATION -D SDUI_DLL_NAME="libsduilo.so" -D SYSTEM_LIBXML -D ENABLE_SDREMOTE -D ENABLE_SDREMOTE_BLUETOOTH -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/i18n -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/common -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/external/bluez_bluetooth/inc -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/sd/inc -I /home/maarten/src/libreoffice/core/sd/source/ui/inc -I /home/maarten/src/libreoffice/core/sd/source/ui/slidesorter/inc -I /home/maarten/src/libreoffice/core/workdir/SdiTarget/sd/sdi -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/oox/generated -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -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/sd/source/ui/func/fuexecuteinteraction.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 <fuexecuteinteraction.hxx>
21
22#include <app.hrc>
23#include <avmedia/mediawindow.hxx>
24#include <basic/sbstar.hxx>
25#include <config_features.h>
26#include <sfx2/app.hxx>
27#include <sfx2/bindings.hxx>
28#include <sfx2/dispatch.hxx>
29#include <sfx2/docfile.hxx>
30#include <sfx2/sfxsids.hrc>
31#include <sfx2/viewfrm.hxx>
32#include <svl/intitem.hxx>
33#include <svl/stritem.hxx>
34#include <svl/urihelper.hxx>
35#include <tools/urlobj.hxx>
36
37#include <DrawViewShell.hxx>
38#include <GraphicDocShell.hxx>
39#include <ViewShell.hxx>
40#include <anminfo.hxx>
41#include <drawdoc.hxx>
42#include <drawview.hxx>
43#include <pgjump.hxx>
44
45#include <com/sun/star/media/XPlayer.hpp>
46
47using namespace css;
48
49namespace sd
50{
51FuExecuteInteraction::FuExecuteInteraction(ViewShell* pViewSh, ::sd::Window* pWin,
52 ::sd::View* pView, SdDrawDocument* pDoc,
53 SfxRequest& rReq)
54 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
55{
56}
57
58rtl::Reference<FuPoor> FuExecuteInteraction::Create(ViewShell* pViewSh, ::sd::Window* pWin,
59 ::sd::View* pView, SdDrawDocument* pDoc,
60 SfxRequest& rReq)
61{
62 rtl::Reference<FuPoor> xFunc(new FuExecuteInteraction(pViewSh, pWin, pView, pDoc, rReq));
63 xFunc->DoExecute(rReq);
64 return xFunc;
65}
66
67void FuExecuteInteraction::DoExecute(SfxRequest&)
68{
69 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
70
71 if (rMarkList.GetMarkCount() != 1)
1
Assuming the condition is false
2
Taking false branch
72 return;
73
74 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
75
76 if (dynamic_cast<const GraphicDocShell*>(mpDocSh) != nullptr
3
Assuming pointer value is null
4
Taking false branch
77 || dynamic_cast<const DrawView*>(mpView) == nullptr)
78 return;
79
80 SdAnimationInfo* pInfo = SdDrawDocument::GetAnimationInfo(pObj);
81 if (!pInfo)
5
Assuming 'pInfo' is non-null
6
Taking false branch
82 return;
83
84 switch (pInfo->meClickAction)
7
Control jumps to 'case 12:' at line 198
85 {
86 case presentation::ClickAction_BOOKMARK:
87 {
88 // Jump to Bookmark (Page or Object)
89 SfxStringItem aItem(SID_NAVIGATOR_OBJECT(27000 +293), pInfo->GetBookmark());
90 mpViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(
91 SID_NAVIGATOR_OBJECT(27000 +293), SfxCallMode::SLOT | SfxCallMode::RECORD, { &aItem });
92 }
93 break;
94
95 case presentation::ClickAction_DOCUMENT:
96 {
97 OUString sBookmark(pInfo->GetBookmark());
98 // Jump to document
99 if (!sBookmark.isEmpty())
100 {
101 SfxStringItem aReferer(SID_REFERER(5000 + 654), mpDocSh->GetMedium()->GetName());
102 SfxStringItem aStrItem(SID_FILE_NAME(5000 + 507), sBookmark);
103 SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
104 SfxFrameItem aFrameItem(SID_DOCFRAME(5000 + 598), pFrame);
105 SfxBoolItem aBrowseItem(SID_BROWSE(5000 + 1658), true);
106 pFrame->GetDispatcher()->ExecuteList(
107 SID_OPENDOC(5000 + 501), SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
108 { &aStrItem, &aFrameItem, &aBrowseItem, &aReferer });
109 }
110 }
111 break;
112
113 case presentation::ClickAction_PREVPAGE:
114 {
115 // Jump to the previous page
116 SfxUInt16Item aItem(SID_NAVIGATOR_PAGE(27000 +292), PAGE_PREVIOUS);
117 mpViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(
118 SID_NAVIGATOR_PAGE(27000 +292), SfxCallMode::SLOT | SfxCallMode::RECORD, { &aItem });
119 }
120 break;
121
122 case presentation::ClickAction_NEXTPAGE:
123 {
124 // Jump to the next page
125 SfxUInt16Item aItem(SID_NAVIGATOR_PAGE(27000 +292), PAGE_NEXT);
126 mpViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(
127 SID_NAVIGATOR_PAGE(27000 +292), SfxCallMode::SLOT | SfxCallMode::RECORD, { &aItem });
128 }
129 break;
130
131 case presentation::ClickAction_FIRSTPAGE:
132 {
133 // Jump to the first page
134 SfxUInt16Item aItem(SID_NAVIGATOR_PAGE(27000 +292), PAGE_FIRST);
135 mpViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(
136 SID_NAVIGATOR_PAGE(27000 +292), SfxCallMode::SLOT | SfxCallMode::RECORD, { &aItem });
137 }
138 break;
139
140 case presentation::ClickAction_LASTPAGE:
141 {
142 // Jump to the last page
143 SfxUInt16Item aItem(SID_NAVIGATOR_PAGE(27000 +292), PAGE_LAST);
144 mpViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(
145 SID_NAVIGATOR_PAGE(27000 +292), SfxCallMode::SLOT | SfxCallMode::RECORD, { &aItem });
146 }
147 break;
148
149 case presentation::ClickAction_SOUND:
150 {
151#if HAVE_FEATURE_AVMEDIA1
152 try
153 {
154 mxPlayer.set(avmedia::MediaWindow::createPlayer(pInfo->GetBookmark(), "" /*TODO?*/),
155 uno::UNO_SET_THROW);
156 mxPlayer->start();
157 }
158 catch (uno::Exception&)
159 {
160 }
161#endif
162 }
163 break;
164
165 case presentation::ClickAction_VERB:
166 {
167 // Assign verb
168 mpView->UnmarkAll();
169 mpView->MarkObj(pObj, mpView->GetSdrPageView());
170 DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell);
171 pDrViewSh->DoVerb(static_cast<sal_Int16>(pInfo->mnVerb));
172 }
173 break;
174
175 case presentation::ClickAction_PROGRAM:
176 {
177 OUString aBaseURL = GetDocSh()->GetMedium()->GetBaseURL();
178 INetURLObject aURL(::URIHelper::SmartRel2Abs(
179 INetURLObject(aBaseURL), pInfo->GetBookmark(), URIHelper::GetMaybeFileHdl(), true,
180 false, INetURLObject::EncodeMechanism::WasEncoded,
181 INetURLObject::DecodeMechanism::Unambiguous));
182
183 if (INetProtocol::File == aURL.GetProtocol())
184 {
185 SfxStringItem aUrl(SID_FILE_NAME(5000 + 507),
186 aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
187 SfxBoolItem aBrowsing(SID_BROWSE(5000 + 1658), true);
188
189 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
190 if (pViewFrm)
191 pViewFrm->GetDispatcher()->ExecuteList(
192 SID_OPENDOC(5000 + 501), SfxCallMode::ASYNCHRON | SfxCallMode::RECORD,
193 { &aUrl, &aBrowsing });
194 }
195 }
196 break;
197
198 case presentation::ClickAction_MACRO:
199 {
200 // Execute macro
201 OUString aMacro = pInfo->GetBookmark();
202
203 if (SfxApplication::IsXScriptURL(aMacro))
8
Assuming the condition is false
9
Taking false branch
204 {
205 uno::Any aRet;
206 uno::Sequence<sal_Int16> aOutArgsIndex;
207 uno::Sequence<uno::Any> aParams;
208 uno::Sequence<uno::Any> aOutArgs;
209
210 mpDocSh->CallXScript(aMacro, aParams, aRet, aOutArgsIndex, aOutArgs);
211 }
212 else
213 {
214 // aMacro has got following format:
215 // "Macroname.Modulname.Libname.Documentname" or
216 // "Macroname.Modulname.Libname.Applicationname"
217 sal_Int32 nIdx{ 0 };
218 const OUString aMacroName = aMacro.getToken(0, '.', nIdx);
219 const OUString aModulName = aMacro.getToken(0, '.', nIdx);
220
221 // Currently the "Call" method only resolves modulename+macroname
222 mpDocSh->GetBasic()->Call(aModulName + "." + aMacroName);
10
Called C++ object pointer is null
223 }
224 }
225 break;
226
227 default:
228 break;
229 }
230}
231
232} // end of namespace sd
233
234/* vim:set shiftwidth=4 softtabstop=4 expandtab: */