Skip to content

Commit 1eb64a7

Browse files
authored
Avoid scary implicit conversion from sexp to bool (#757)
1 parent 35a1905 commit 1eb64a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/zip.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
#include "rapidxml/rapidxml_print.h"
44

5+
#include "cpp11/as.hpp"
56
#include "cpp11/function.hpp"
67
#include "cpp11/raws.hpp"
8+
#include "cpp11/sexp.hpp"
79

810
std::string zip_buffer(const std::string& zip_path,
911
const std::string& file_path) {
@@ -19,7 +21,8 @@ std::string zip_buffer(const std::string& zip_path,
1921
bool zip_has_file(const std::string& zip_path,
2022
const std::string& file_path) {
2123
cpp11::function zip_has_file = cpp11::package("readxl")["zip_has_file"];
22-
return zip_has_file(zip_path, file_path);
24+
cpp11::sexp out = zip_has_file(zip_path, file_path);
25+
return cpp11::as_cpp<bool>(out);
2326
}
2427

2528
std::string xml_print(std::string xml) {

0 commit comments

Comments
 (0)