Skip to content

Commit

Permalink
Do not throw iterator pointer away (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiolo authored Sep 8, 2024
1 parent e65b72d commit e1c0e35
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,10 @@ struct Document {
wxDataObjectComposite dragdata;
if (c && !c->text.t && c->text.image) {
Image *im = c->text.image;
if (!im->image_data.empty() &&
imagetypes.find(im->image_type) != imagetypes.end()) {
wxBitmap bm = ConvertBufferToWxBitmap(im->image_data,
imagetypes.at(im->image_type).first);
if (auto imagetypeit = imagetypes.find(im->image_type);
imagetypeit != imagetypes.end() && !im->image_data.empty()) {
wxBitmap bm =
ConvertBufferToWxBitmap(im->image_data, imagetypeit->second.first);
dragdata.Add(new wxBitmapDataObject(bm));
}
} else {
Expand Down Expand Up @@ -445,10 +445,10 @@ struct Document {
sys->cellclipboard = c ? c->Clone(nullptr) : selected.g->CloneSel(selected);
if (c && !c->text.t && c->text.image) {
Image *im = c->text.image;
if (!im->image_data.empty() &&
imagetypes.find(im->image_type) != imagetypes.end()) {
wxBitmap bm = ConvertBufferToWxBitmap(im->image_data,
imagetypes.at(im->image_type).first);
if (auto imagetypeit = imagetypes.find(im->image_type);
imagetypeit != imagetypes.end() && !im->image_data.empty()) {
wxBitmap bm =
ConvertBufferToWxBitmap(im->image_data, imagetypeit->second.first);
if (wxTheClipboard->Open()) {
wxTheClipboard->SetData(new wxBitmapDataObject(bm));
wxTheClipboard->Close();
Expand Down

0 comments on commit e1c0e35

Please sign in to comment.