Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when trying to access current value of some "list" type ValueID's #381

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 4 comments
Assignees
Milestone

Comments

@GoogleCodeExporter
Copy link

Given ValueID v, sometimes when I execute this:

string str_prop_value;
Manager::Get()->GetValueAsString(v, &str_prop_value);

I get the error:

"Expression: vector subscript out of range"

on line 71 of src/value_classes/ValueList.h:

Item const& GetItem()const{ return m_items[m_valueIdx]; }

Here's the call stack:

OpenZWave::ValueList::GetItem() Line 71
OpenZWave::Manager::GetValueAsString(const OpenZWave::ValueID & _id, 
std::basic_string<char,std::char_traits<char>,std::allocator<char> > * o_value) 
Line 2020

When examining "m_items" in the debugger, I note that it is zero length, but 
m_valueIdx is set to 1. So essentially this is a "list" type ValueID, but there 
are no items in the list of possible options. But the code still tries to just 
grab item 1, which is out of range.

I will note that I only seem to get this error BEFORE the 
"Notification::Type_AllNodesQueried" notification event.  So maybe this is by 
design and I'm just trying to access the ValueIDs too early? But I was 
wondering if you'd rather return something like an empty label though in this 
case. Or maybe throw an exception describing what the issue is.

I am using the latest trunk version as of today on Windows 7 in Visual Studio 
2013.

Thanks!

Original issue reported on code.google.com by rkrob...@gmail.com on 26 Oct 2014 at 9:54

@GoogleCodeExporter
Copy link
Author

Yep - I can see where this is going wrong. I assume you are accessing once you 
got the ValueAdded Notification for that value?

I need to look a bit deeper into the code path, but will try to fix it up in 
the next release. 

Original comment by jus...@dynam.ac on 5 Dec 2014 at 5:11

  • Changed state: Accepted
  • Added labels: Milestone-1.4

@GoogleCodeExporter
Copy link
Author

Original comment by jus...@dynam.ac on 8 Dec 2014 at 5:53

@GoogleCodeExporter
Copy link
Author

yep correct that is my workaround.

Original comment by rkrob...@gmail.com on 9 Feb 2015 at 6:53

@Fishwaldo
Copy link
Member

This should be fixed now. Awaiting testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants