Browse Source

Add runtime error on set vert and tex coord index out of bounds

master
Krisjanis Rijnieks 9 years ago
parent
commit
e7a36c4a86
  1. 6
      src/Surfaces/GridWarpSurface.cpp

6
src/Surfaces/GridWarpSurface.cpp

@ -117,8 +117,7 @@ ofPolyline GridWarpSurface::getTextureHitArea(){
void GridWarpSurface::setVertex(int index, ofVec2f p){ void GridWarpSurface::setVertex(int index, ofVec2f p){
if(index >= mesh.getVertices().size()){ if(index >= mesh.getVertices().size()){
ofLog() << "Vertex with this index does not exist: " << index << endl; throw runtime_error("Vertex with provided index does not exist");
return;
} }
mesh.setVertex(index, p); mesh.setVertex(index, p);
} }
@ -135,8 +134,7 @@ void GridWarpSurface::setVertices(vector<ofVec2f> v){
void GridWarpSurface::setTexCoord(int index, ofVec2f t){ void GridWarpSurface::setTexCoord(int index, ofVec2f t){
if(index >= mesh.getVertices().size()){ if(index >= mesh.getVertices().size()){
ofLog() << "Texture coordinate with this index does not exist: " << index << endl; throw runtime_error("Texture coordinate with provided index does not exist");
return;
} }
mesh.setTexCoord(index, t); mesh.setTexCoord(index, t);
} }

Loading…
Cancel
Save