kopia lustrzana https://github.com/weetmuts/wmbusmeters
Fix accessing empty string
Fixes the following crash: (gdb) bt #0 0x00005555555738d0 in abort@plt () #1 0x0000555555589888 in std::__replacement_assert (__file=<optimized out>, __line=<optimized out>, __function=<optimized out>, __condition=<optimized out>) at /usr/include/c++/9/x86_64-redhat-linux/bits/c++config.h:2533 #2 0x00005555555d1e37 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::front (this=0x7ffff7a226d0) at /usr/include/c++/9/bits/basic_string.h:1123 #3 0x00005555555ce8c5 in doesIdMatchExpression (id=..., match=...) at src/util.cc:513 #4 0x00005555555cea92 in doesIdMatchExpressions (id=..., mes=...) at src/util.cc:560 #5 0x000055555558aa56 in MeterCommonImplementation::isTelegramForMe (this=0x555555661c28, t=0x7ffff7a227b0) at src/meters.cc:188 #6 0x000055555558c0e0 in MeterCommonImplementation::handleTelegram (this=0x555555661c28, input_frame=...) at src/meters.cc:289 #7 0x000055555558c87a in MeterCommonImplementation::<lambda(std::vector<unsigned char, std::allocator<unsigned char> >)>::operator() (__closure=<optimized out>, input_frame=...) at /usr/include/c++/9/bits/stl_algobase.h:465 #8 std::_Function_handler<bool(std::vector<unsigned char, std::allocator<unsigned char> >), MeterCommonImplementation::MeterCommonImplementation(WMBus*, MeterInfo&, MeterType, int)::<lambda(std::vector<unsigned char, std::allocator<unsigned char> >)> >::_M_invoke(const std::_Any_data &, std::vector<unsigned char, std::allocator<unsigned char> > &&) (__functor=..., __args#0=...) at /usr/include/c++/9/bits/std_function.h:285 #9 0x00005555555da01f in std::function<bool (std::vector<unsigned char, std::allocator<unsigned char> >)>::operator()(std::vector<unsigned char, std::allocator<unsigned char> >) const (__args#0=..., this=0x7ffff7a22c70) at /usr/include/c++/9/bits/std_function.h:685 #10 WMBusCommonImplementation::handleTelegram (this=this@entry=0x555555661b40, frame=...) at src/wmbus.cc:3328 #11 0x00005555555fbf7b in WMBusRTLWMBUS::processSerialData (this=0x555555661ad0) at /usr/include/c++/9/bits/stl_algobase.h:465 #12 0x00005555555cb001 in std::function<void ()>::operator()() const (this=<optimized out>) at /usr/include/c++/9/bits/std_function.h:685 #13 SerialCommunicationManagerImp::eventLoop (this=0x5555556617c0) at src/serial.cc:795 #14 0x00007ffff7f554e2 in ?? () #15 0x0000000000000000 in ?? () Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>pull/86/head
rodzic
97c2c61f39
commit
a2de4d4b9b
|
@ -510,7 +510,7 @@ bool doesIdMatchExpression(string id, string match)
|
|||
}
|
||||
|
||||
bool wildcard_used = false;
|
||||
if (match.front() == '*')
|
||||
if (match.length() && match.front() == '*')
|
||||
{
|
||||
wildcard_used = true;
|
||||
match.erase(0,1);
|
||||
|
|
Ładowanie…
Reference in New Issue