summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/ExtractFunction.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/passes/ExtractFunction.cpp b/src/passes/ExtractFunction.cpp
index 0939ebe28..f75c04cbe 100644
--- a/src/passes/ExtractFunction.cpp
+++ b/src/passes/ExtractFunction.cpp
@@ -80,10 +80,11 @@ struct ExtractFunctionIndex : public Pass {
}
Index i = std::stoi(index);
if (i >= module->functions.size()) {
- Fatal() << "Invalid function index";
+ Fatal() << "Out of bounds function index " << i << "! (module has only "
+ << module->functions.size() << " functions)";
}
// Assumes imports are at the beginning
- Name name = module->functions[std::stoi(index)]->name;
+ Name name = module->functions[i]->name;
extract(runner, module, name);
}
};