summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools.cpp b/tools.cpp
index 1839f6b..3a80ff7 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -17,12 +17,16 @@ using namespace tnt;
istream& operator>>( istream& is, tChannelID& ret )
{
- if ( is.rdbuf()->in_avail() > 0 ) {
- string line;
- if ( !getline( is, line ) || ( !line.empty() && !( ret = tChannelID::FromString( line.c_str() ) ).Valid() ) )
- is.setstate( ios::badbit );
- }
- return is;
+ string line;
+ if ( !getline( is, line ) ) {
+ if ( !is.eof() )
+ is.setstate( ios::badbit );
+ return is;
+ }
+
+ if ( !line.empty() && !( ret = tChannelID::FromString( line.c_str() ) ).Valid() )
+ is.setstate( ios::badbit );
+ return is;
}
namespace vdrlive {