Opened 10 years ago

Closed 8 years ago

#7154 closed Patch - Bug Fix (Won't Fix)

[PATCH] Check the return value of function calls inside of libmythtv

Reported by: Erik Hovland <erik@…> Owned by: danielk
Priority: trivial Milestone: unknown
Component: MythTV - General Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

query.next() is usually checked. So libmythtv should do it too. But there are some other calls in there as well, like CreateChannel?() or Run() that also are usually checked.

Attachments (2)

libs_libmythtv-check-return (38.7 KB) - added by Erik Hovland <erik@…> 10 years ago.
Check the return value of calls in libmythtv
libs_libmythtv-check-return-ticket-7154 (32.7 KB) - added by Erik Hovland <erik@…> 10 years ago.
Same patch as before but against trunk as of 2010-02-03

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Erik Hovland <erik@…>

Attachment: libs_libmythtv-check-return added

Check the return value of calls in libmythtv

Changed 10 years ago by Erik Hovland <erik@…>

Same patch as before but against trunk as of 2010-02-03

comment:1 Changed 9 years ago by robertm

Owner: changed from Isaac Richards to danielk
Status: newassigned

comment:2 Changed 9 years ago by beirdo

Summary: Check the return value of function calls inside of libmythtv[PATCH] Check the return value of function calls inside of libmythtv
Type: defectPatch - Bug Fix

comment:3 Changed 8 years ago by danielk

Resolution: Won't Fix
Status: assignedclosed

Most of these change some crufty database code of the form:

  if (query.size() <= 0)
    return -1;
  query.next();
  return query.value(0).toInt();

to

  if (query.size() <= 0)
      return -1;
  if (!query.next())
      return -1;
  return query.value(0).toInt();

But really the code should be of the form:

  if (!query.next())
      return -1;
  return query.value(0).toInt();

Since the original code will work whenever size() is supported and the patched code will still fail when it isn't I'm just going to stick with the original code.

Note: See TracTickets for help on using tickets.