reverted to 11769 and added (std::nothrow)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27452 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Fredrik Modeen 2008-09-12 14:06:56 +00:00
parent dd84bf1de8
commit ee652e3aab
1 changed files with 10 additions and 2 deletions

View File

@ -10,6 +10,7 @@
#include <List.h>
#include <SerialPort.h>
#include <new>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@ -18,6 +19,7 @@
#include <unistd.h>
#include <termios.h>
/* The directory where the serial driver publishes its devices */
#define SERIAL_DIR "/dev/ports"
@ -62,7 +64,7 @@ BSerialPort::BSerialPort()
fFlow(B_HARDWARE_CONTROL),
fTimeout(B_INFINITE_TIMEOUT),
fBlocking(true),
_fDevices(new BList)
_fDevices(new(std::nothrow) BList)
{
ScanDevices();
}
@ -479,9 +481,15 @@ BSerialPort::WaitForInput(void)
int32
BSerialPort::CountDevices()
{
int32 count = 0;
// Refresh devices list
ScanDevices();
return _fDevices->CountItems();
if (_fDevices != NULL)
count = _fDevices->CountItems();
return count;
}