From 85671ef6f11de77af719869c334920895cbab1e7 Mon Sep 17 00:00:00 2001 From: dehnert Date: Wed, 18 Jul 2018 13:56:16 +0200 Subject: [PATCH] fixing segfault pointed out by Paul Gainer --- src/storm-pars-cli/storm-pars.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/storm-pars-cli/storm-pars.cpp b/src/storm-pars-cli/storm-pars.cpp index ec3f65f29..badcb0212 100644 --- a/src/storm-pars-cli/storm-pars.cpp +++ b/src/storm-pars-cli/storm-pars.cpp @@ -58,7 +58,7 @@ namespace storm { template SampleInformation parseSamples(std::shared_ptr const& model, std::string const& sampleString, bool graphPreserving) { - STORM_LOG_THROW(model->isSparseModel(), storm::exceptions::NotSupportedException, "Sampling is only supported for sparse models."); + STORM_LOG_THROW(!model || model->isSparseModel(), storm::exceptions::NotSupportedException, "Sampling is only supported for sparse models."); SampleInformation sampleInfo(graphPreserving); if (sampleString.empty()) { @@ -465,8 +465,12 @@ namespace storm { } std::vector> regions = parseRegions(model); - SampleInformation samples = parseSamples(model, parSettings.getSamples(), parSettings.isSamplesAreGraphPreservingSet()); - samples.exact = parSettings.isSampleExactSet(); + std::string samplesAsString = parSettings.getSamples(); + SampleInformation samples; + if (!samplesAsString.empty()) { + samples = parseSamples(model, samplesAsString, parSettings.isSamplesAreGraphPreservingSet()); + samples.exact = parSettings.isSampleExactSet(); + } if (model) { storm::cli::exportModel(model, input);