view: catch exception on Visual constructor #378

This commit is contained in:
nick black 2020-03-02 20:52:03 -05:00
parent 5a8107b788
commit e7d0ce72dd
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -173,7 +173,14 @@ int main(int argc, char** argv){
std::array<char, 128> errbuf;
int frames = 0;
int averr;
auto ncv = std::make_unique<Visual>(argv[i], &averr, 1, 0, stretchmode);
std::unique_ptr<Visual> ncv;
try{
ncv = std::make_unique<Visual>(argv[i], &averr, 1, 0, stretchmode);
}catch(std::exception& e){
nc.stop();
std::cerr << argv[i] << ": " << e.what() << "\n";
return EXIT_FAILURE;
}
if(!ncv){
av_make_error_string(errbuf.data(), errbuf.size(), averr);
nc.stop();