<div dir="ltr"><div><div><div>Hi,<br><br>any suggestions how should I test if a file was loaded successfully? Example of code is in the porting guide I'm working on [1].<br><br></div>What was in the libLAS code I'm using is <br><br>    LASReaderH LAS_reader = LASReader_Create("somefile.las");<br>    LASHeaderH LAS_header = LASReader_GetHeader(LAS_reader);<br>    if (LAS_header == NULL)<br>        // fail with "<span class="">Input file is not a LAS LiDAR point cloud</span>"<br><br></div>Now I'm using (now check):<br><br>    std::unique_ptr<LasReader> las_reader(LasReader())<br><br></div>Somewhere in the PDAL source code I've seen:<br><div><div><br>    Stage *stage = factory.createStage(driver);<br>        if (!stage)<br>            // fail with "reader creation failed"<br></div><div><br>Later followed by (or any other appropriate pointer handling):<br><br></div><div>    std::unique_ptr<Stage>(s)<br><br></div><div>Is this the right approach to use in general with functions in PDAL returning pointers? Can I use it with the LasReader()?<br><br></div><div>Are there any other things I should check for in this opening and reading phase? Some typical error states? Wrong/unknow format? Or should I just wrap this whole part in a big try-catch with pdal_error?<br></div><div><br></div><div>Thanks for suggestions,<br></div><div>Vaclav<br></div><div><br><div>[1] <a href="https://github.com/wenzeslaus/PDAL/blob/liblas-to-pdal-transition/doc/tutorial/liblas_to_pdal.rst">https://github.com/wenzeslaus/PDAL/blob/liblas-to-pdal-transition/doc/tutorial/liblas_to_pdal.rst</a><br></div></div></div></div>