Skip to content

Commit

Permalink
ews: fix std::optional access before initialization
Browse files Browse the repository at this point in the history
References: GXH-102, GXF-1734
  • Loading branch information
juliaschroeder authored and jengelh committed Aug 21, 2024
1 parent db4c838 commit f1d7ee1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions exch/ews/requests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,13 @@ void process(mCreateItemRequest&& request, XMLElement* response, const EWSContex

mCreateItemResponse data;

bool hasAccess = true;
std::optional<sFolderSpec> targetFolder;
if(request.SavedItemFolderId)
targetFolder = ctx.resolveFolder(request.SavedItemFolderId->folderId);
std::string dir = ctx.getDir(*targetFolder);
if(!targetFolder)
targetFolder = ctx.resolveFolder(tDistinguishedFolderId("outbox"));
else
hasAccess = ctx.permissions(dir, targetFolder->folderId) & (frightsOwner | frightsCreate);
targetFolder = ctx.resolveFolder(tDistinguishedFolderId("outbox"));
std::string dir = ctx.getDir(*targetFolder);
bool hasAccess = ctx.permissions(dir, targetFolder->folderId) & (frightsOwner | frightsCreate);

if(!request.MessageDisposition)
request.MessageDisposition = Enum::SaveOnly;
Expand Down

0 comments on commit f1d7ee1

Please sign in to comment.