mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 06:01:29 +00:00
GUI: fix sample paste crash
This commit is contained in:
parent
a8da4f0dba
commit
9c4fed2f4e
1 changed files with 8 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include "gui.h"
|
||||
#include "../ta-log.h"
|
||||
#include <fmt/printf.h>
|
||||
#include <imgui.h>
|
||||
|
||||
|
@ -712,6 +713,9 @@ void FurnaceGUI::doAction(int what) {
|
|||
DivSample* sample=e->song.sample[curSample];
|
||||
sample->prepareUndo(true);
|
||||
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?sample->samples:sampleSelStart;
|
||||
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
||||
if (pos<0) pos=0;
|
||||
logV("paste position: %d",pos);
|
||||
|
||||
e->lockEngine([this,sample,pos]() {
|
||||
if (!sample->insert(pos,sampleClipboardLen)) {
|
||||
|
@ -739,6 +743,8 @@ void FurnaceGUI::doAction(int what) {
|
|||
DivSample* sample=e->song.sample[curSample];
|
||||
sample->prepareUndo(true);
|
||||
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?0:sampleSelStart;
|
||||
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
||||
if (pos<0) pos=0;
|
||||
|
||||
e->lockEngine([this,sample,pos]() {
|
||||
if (sample->depth==8) {
|
||||
|
@ -767,6 +773,8 @@ void FurnaceGUI::doAction(int what) {
|
|||
DivSample* sample=e->song.sample[curSample];
|
||||
sample->prepareUndo(true);
|
||||
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?0:sampleSelStart;
|
||||
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
||||
if (pos<0) pos=0;
|
||||
|
||||
e->lockEngine([this,sample,pos]() {
|
||||
if (sample->depth==8) {
|
||||
|
|
Loading…
Reference in a new issue