@@ -191,7 +191,7 @@ class Core : public Http {
191191 // ============================== TICK ==============================
192192 // тикер, вызывать в loop. Вернёт true, если был обработан Update
193193 bool tick () {
194- if (!_state || !_token. length () ) return 0 ;
194+ if (!_state) return 0 ;
195195
196196// OTA
197197#ifndef FB_NO_FILE
@@ -261,6 +261,7 @@ class Core : public Http {
261261
262262 // отправить запрос на обновление
263263 Result getUpdates (bool wait, bool allowLongPool = true ) {
264+ if (!_token.length ()) return Result ();
264265 FB_LOG (" getUpdates" );
265266 Packet p (tg_cmd::getUpdates, _token);
266267 if (_poll_mode == Poll::Long && allowLongPool) p[tg_api::timeout] = (uint16_t )(_poll_prd / 1000 );
@@ -307,6 +308,7 @@ class Core : public Http {
307308
308309 // отправить пакет
309310 Result sendPacket (Packet& packet, bool wait = true , bool * sent = nullptr ) {
311+ if (!_token.length ()) return Result ();
310312 if (_poll_wait) {
311313 _poll_wait = 0 ;
312314 FB_LOG (" stop polling" );
@@ -335,6 +337,7 @@ class Core : public Http {
335337
336338 // получить путь к файлу относительно корня api
337339 String getFilePath (Text fileID) {
340+ if (!_token.length ()) return String ();
338341 FB_LOG (" getFile" );
339342 fb::Packet p (tg_cmd::getFile, _token);
340343 p[tg_api::file_id] = fileID;
@@ -349,6 +352,7 @@ class Core : public Http {
349352
350353 // получить прямую ссылку на файл
351354 String getFileLink (Text fileID) {
355+ if (!_token.length ()) return String ();
352356 String link = F (" https://" TELEGRAM_HOST " /file/bot" );
353357 link += _token;
354358 link += ' /' ;
0 commit comments