File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -123,12 +123,15 @@ tesseract::TessBaseAPI *get_engine(TessPtr engine) {
123123 tesseract::TessBaseAPI *api = make_analyze_api ();
124124 writable::logicals out (params.size ());
125125 STRING str;
126- for (int i = 0 ; i < params.size (); i++)
126+ for (int i = 0 ; i < params.size (); i++) {
127127#if TESSERACT_MAJOR_VERSION >= 5
128128 out[i] = api->GetVariableAsString (std::string (params.at (i)).c_str (), &str);
129129#else
130- out[i] = api->GetStringVariable (std::string (params.at (i)).c_str (), &str);
130+ const char *value =
131+ api->GetStringVariable (std::string (params.at (i)).c_str ());
132+ out[i] = (value != nullptr );
131133#endif
134+ }
132135 api->End ();
133136 delete api;
134137 return out;
@@ -176,8 +179,10 @@ tesseract::TessBaseAPI *get_engine(TessPtr engine) {
176179 if (api->GetVariableAsString (std::string (params.at (i)).c_str (), &str)) {
177180 values.push_back (str);
178181#else
179- if (api->GetStringVariable (std::string (params.at (i)).c_str (), &str)) {
180- values.push_back (str.string ());
182+ const char *value =
183+ api->GetStringVariable (std::string (params.at (i)).c_str ());
184+ if (value) {
185+ values.push_back (value);
181186#endif
182187 } else {
183188 values.push_back (" " );
You can’t perform that action at this time.
0 commit comments