Fix: throw of an uncontrolled std::out_of_range exception in RichLabel.cpp

`std::string::substr` throws `std::out_of_range` if starting position is bigger than length of a string. So, it's necessary to check the position before the call.