From 763d4ceb11da081df6653dec29d54e4ba1ff2cc2 Mon Sep 17 00:00:00 2001 From: JonWel Date: Mon, 15 Feb 2016 01:03:21 +0100 Subject: [PATCH] Correct get_parameter_information_string, fixes #974 Put the catch in a more useful way and solves the call to CoolProp::get_parameter_information. --- src/CoolPropLib.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/CoolPropLib.cpp b/src/CoolPropLib.cpp index e61ad20f..9b84bae5 100644 --- a/src/CoolPropLib.cpp +++ b/src/CoolPropLib.cpp @@ -251,15 +251,12 @@ EXPORT_CODE long CONVENTION get_parameter_information_string(const char *param, { try{ int key = CoolProp::get_parameter_index(param); - if (key >= 0){ - std::string s = CoolProp::get_parameter_information(key, Output); - return str2buf(s, Output, n) ? 1 : 0; - } - else{ - str2buf(format("parameter is invalid: %s", param), Output, n); - } + std::string s = CoolProp::get_parameter_information(key, "long"); + return str2buf(s, Output, n) ? 1 : 0; } - catch(...){} + catch(...){ + str2buf(format("parameter is invalid: %s", param), Output, n); + } return 0; } EXPORT_CODE long CONVENTION get_fluid_param_string(const char *fluid, const char *param, char * Output, int n) @@ -607,4 +604,4 @@ EMSCRIPTEN_BINDINGS(coolprop_lib_bindings) { function("F2K", &F2K); } -#endif \ No newline at end of file +#endif