Commit 071b6fa0 authored by peastman's avatar peastman
Browse files

Merge pull request #698 from rmcgibbo/range-check

range check getPlatform()
parents 2bf08a95 c1cbd441
...@@ -134,7 +134,10 @@ int Platform::getNumPlatforms() { ...@@ -134,7 +134,10 @@ int Platform::getNumPlatforms() {
} }
Platform& Platform::getPlatform(int index) { Platform& Platform::getPlatform(int index) {
return *getPlatforms()[index]; if (index >= 0 && index < getNumPlatforms()) {
return *getPlatforms()[index];
}
throw OpenMMException("Invalid platform index");
} }
Platform& Platform::getPlatformByName(const string& name) { Platform& Platform::getPlatformByName(const string& name) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment