Skip to content

Commit 7fc9c4f

Browse files
committed
Add input validation when loading parameters in FileReader
1 parent abc023b commit 7fc9c4f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Plugins/SpikeViewer/SpikePlots.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ ProjectionAxes::ProjectionAxes (SpikeDisplayCanvas* canvas,
986986
n2ProjIdx (proj, &ampDim1, &ampDim2);
987987

988988
channelNameLabel = std::make_unique<Label>();
989-
channelNameLabel->setFont (13);
989+
channelNameLabel->setFont (FontOptions (13.0f));
990990
channelNameLabel->setJustificationType (Justification::left);
991991
channelNameLabel->setColour (Label::textColourId, Colours::white.withAlpha (0.4f));
992992
channelNameLabel->setText (channelName, dontSendNotification);

Source/Processors/FileReader/FileReader.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ void FileReader::parameterValueChanged (Parameter* p)
112112
}
113113
else if (p->getName() == "start_time")
114114
{
115+
if (! input)
116+
return;
117+
115118
TimeParameter* tp = static_cast<TimeParameter*> (p);
116119
startSample = millisecondsToSamples (tp->getTimeValue()->getTimeInMilliseconds());
117120

@@ -122,6 +125,9 @@ void FileReader::parameterValueChanged (Parameter* p)
122125
}
123126
else if (p->getName() == "end_time")
124127
{
128+
if (! input)
129+
return;
130+
125131
TimeParameter* tp = static_cast<TimeParameter*> (p);
126132
stopSample = millisecondsToSamples (tp->getTimeValue()->getTimeInMilliseconds());
127133

@@ -194,6 +200,12 @@ void FileReader::initialize (bool signalChainIsLoading)
194200
if (isEnabled)
195201
return;
196202

203+
if (! defaultFile.exists())
204+
{
205+
CoreServices::sendStatusMessage ("File Reader: default file not found");
206+
return;
207+
}
208+
197209
//setFile (defaultFile.getFullPathName(), false);
198210
input.reset (createBuiltInFileSource (0));
199211
input->openFile (defaultFile.getFullPathName());

0 commit comments

Comments
 (0)