aboutsummaryrefslogtreecommitdiffstats
path: root/android/hw-events.c
diff options
context:
space:
mode:
Diffstat (limited to 'android/hw-events.c')
-rw-r--r--android/hw-events.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/android/hw-events.c b/android/hw-events.c
index 7c3f9e9..4318f65 100644
--- a/android/hw-events.c
+++ b/android/hw-events.c
@@ -106,7 +106,7 @@ eventList_findCodeByName( EventList list,
if (namelen <= 0)
return -1;
- for ( ; list != NULL; list += 1 ) {
+ for ( ; list->name != NULL; list += 1 ) {
if ( !memcmp(name, list->name, namelen) &&
list->name[namelen] == 0 )
{
@@ -167,7 +167,11 @@ android_event_from_str( const char* name,
q = pend;
list = eventList_findByType( *ptype );
- *pcode = eventList_findCodeByName( list, p, q-p );
+ if (list == NULL) {
+ *pcode = -1;
+ } else {
+ *pcode = eventList_findCodeByName( list, p, q-p );
+ }
if (*pcode < 0) {
*pcode = (int) strtol( p, &end, 0 );
if (end != q)