author | alwin <alwin> | 2004-04-21 22:57:53 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-21 22:57:53 (UTC) |
commit | 15abdc3ac4e7406d15a8a59f43b3ae669099074a (patch) (unidiff) | |
tree | 2ed419f8edf698561359f46dfbf177767f974452 | |
parent | 2a04bf465c332f5e879470f7436852e2d9686083 (diff) | |
download | opie-15abdc3ac4e7406d15a8a59f43b3ae669099074a.zip opie-15abdc3ac4e7406d15a8a59f43b3ae669099074a.tar.gz opie-15abdc3ac4e7406d15a8a59f43b3ae669099074a.tar.bz2 |
fixed a possible crasher
-rw-r--r-- | noncore/graphics/opie-eye/slave/png_slave.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/graphics/opie-eye/slave/png_slave.cpp b/noncore/graphics/opie-eye/slave/png_slave.cpp index 86e1cdc..21555b4 100644 --- a/noncore/graphics/opie-eye/slave/png_slave.cpp +++ b/noncore/graphics/opie-eye/slave/png_slave.cpp | |||
@@ -57,25 +57,26 @@ static const char* compressions[] = | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | // interlaced modes | 59 | // interlaced modes |
60 | static const char* interlaceModes[] = { | 60 | static const char* interlaceModes[] = { |
61 | QT_TR_NOOP("None"), | 61 | QT_TR_NOOP("None"), |
62 | QT_TR_NOOP("Adam7") | 62 | QT_TR_NOOP("Adam7") |
63 | }; | 63 | }; |
64 | 64 | ||
65 | 65 | ||
66 | static void read_comment( const QString& inf, | 66 | static void read_comment( const QString& inf, |
67 | bool readComments, QString& str ) { | 67 | bool readComments, QString& str ) { |
68 | QFile f(inf); | 68 | QFile f(inf); |
69 | f.open(IO_ReadOnly); | 69 | if (!f.exists()) return; |
70 | if (!f.open(IO_ReadOnly)) return; | ||
70 | 71 | ||
71 | if (f.size() < 26) return; | 72 | if (f.size() < 26) return; |
72 | // the technical group will be read from the first 26 bytes. If the file | 73 | // the technical group will be read from the first 26 bytes. If the file |
73 | // is smaller, we can't even read this. | 74 | // is smaller, we can't even read this. |
74 | 75 | ||
75 | uchar *data = new uchar[f.size()+1]; | 76 | uchar *data = new uchar[f.size()+1]; |
76 | f.readBlock(reinterpret_cast<char*>(data), f.size()); | 77 | f.readBlock(reinterpret_cast<char*>(data), f.size()); |
77 | data[f.size()]='\n'; | 78 | data[f.size()]='\n'; |
78 | 79 | ||
79 | // find the start | 80 | // find the start |
80 | if (data[0] == 137 && data[1] == 80 && data[2] == 78 && data[3] == 71 && | 81 | if (data[0] == 137 && data[1] == 80 && data[2] == 78 && data[3] == 71 && |
81 | data[4] == 13 && data[5] == 10 && data[6] == 26 && data[7] == 10 ) | 82 | data[4] == 13 && data[5] == 10 && data[6] == 26 && data[7] == 10 ) |